diff --git a/src/MySql/MySql.Autorest/Properties/AssemblyInfo.cs b/src/MySql/MySql.Autorest/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..8881a048e5dd --- /dev/null +++ b/src/MySql/MySql.Autorest/Properties/AssemblyInfo.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache License, Version 2.0 (the ""License""); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an ""AS IS"" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +// is regenerated. + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")] +[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")] +[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")] +[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - MySql")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.3.0")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.3.0")] +[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly: System.CLSCompliantAttribute(false)] diff --git a/src/MySql/MySql.Autorest/custom/Restore-AzMySqlFlexibleServer_GeoRestore.ps1 b/src/MySql/MySql.Autorest/custom/Restore-AzMySqlFlexibleServer_GeoRestore.ps1 new file mode 100644 index 000000000000..00fd3f156d82 --- /dev/null +++ b/src/MySql/MySql.Autorest/custom/Restore-AzMySqlFlexibleServer_GeoRestore.ps1 @@ -0,0 +1,208 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +$DELEGATION_SERVICE_NAME = "Microsoft.DBforMySQL/flexibleServers" +function Restore-AzMySqlFlexibleServer_GeoRestore { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IServerAutoGenerated])] + [CmdletBinding(PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Description('Restore a server from an existing backup using GeoRestore')] + param( + [Parameter(Mandatory, HelpMessage = 'The name of the server.')] + [Alias('ServerName')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')] + [System.String] + ${Name}, + + [Parameter(Mandatory, HelpMessage = 'The name of the resource group that contains the resource.')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')] + [System.String] + ${ResourceGroupName}, + + [Parameter(HelpMessage = 'The subscription ID that identifies an Azure subscription.')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] + [System.String] + ${SubscriptionId}, + + [Parameter(Mandatory, ValueFromPipeline, HelpMessage = 'The source server object to restore from.')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20210501.IServerAutoGenerated] + ${InputObject}, + + [Parameter(Mandatory, HelpMessage = 'The location to restore the server to.')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')] + [System.String] + ${Location}, + + [Parameter(HelpMessage = 'The name of the sku, typically, tier + family + cores, e.g., B_Gen4_1, GP_Gen5_8.')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')] + [System.String] + ${Sku}, + + [Parameter(HelpMessage = 'Application-specific metadata in the form of key-value pairs.')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.MySql.Models.Api20171201.IServerForCreateTags]))] + [System.Collections.Hashtable] + ${Tag}, + + [Parameter(Mandatory, HelpMessage = 'Use Geo mode to restore')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Body')] + [System.Management.Automation.SwitchParameter] + ${UseGeoRestore}, + + [Parameter(HelpMessage = 'The credentials, account, tenant, and subscription used for communication with Azure.')] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Azure')] + [System.Management.Automation.PSObject] + ${DefaultProfile}, + + [Parameter(HelpMessage = 'Run the command as a job.')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + ${AsJob}, + + [Parameter(DontShow, HelpMessage = 'Wait for .NET debugger to attach.')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.SendAsyncStep[]] + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Runtime.SendAsyncStep[]] + ${HttpPipelinePrepend}, + + [Parameter(HelpMessage = 'Run the command asynchronously.')] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')] + [System.Uri] + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')] + [System.Management.Automation.PSCredential] + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.MySql.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + ${ProxyUseDefaultCredentials} + ) + + process { + try { + + $PSBoundParameters.CreateMode = [Microsoft.Azure.PowerShell.Cmdlets.MySql.Support.CreateMode]::GeoRestore + $null = $PSBoundParameters.Remove('UseGeoRestore') + + $server = $PSBoundParameters['InputObject'] + $PSBoundParameters.SourceServerResourceId = $server.Id + $PSBoundParameters.Location = $server.Location + $null = $PSBoundParameters.Remove('InputObject') + + if ($PSBoundParameters.ContainsKey('Location')) { + $PSBoundParameters.Location = $PSBoundParameters['Location'] + $null = $PSBoundParameters.Remove('Location') + } + + if ($PSBoundParameters.ContainsKey('Zone')) { + $PSBoundParameters.AvailabilityZone = $PSBoundParameters.Zone + $null = $PSBoundParameters.Remove('Zone') + } + + if ($PSBoundParameters.ContainsKey('Sku')) { + $PSBoundParameters.SkuName = $PSBoundParameters['Sku'] + $null = $PSBoundParameters.Remove('Sku') + } + + if ($PSBoundParameters.ContainsKey('Subnet')) { + if (!(Get-Module -ListAvailable -Name Az.Network)) { + throw 'Please install Az.Network module by entering "Install-Module -Name Az.Network"' + } + else { + Import-Module -Name Az.Network + } + $VnetId = [string]::Join("/", $PSBoundParameters.Subnet.split("/")[0..8]) + $SubnetModel = Get-AzVirtualNetworkSubnetConfig -ResourceId $PSBoundParameters.Subnet + $Delegations = Get-AzDelegation -Subnet $SubnetModel + if ($null -ne $Delegations) { + # Valid but incorrect delegation + $Delegations | ForEach-Object { if ($PSItem.ServiceName -ne $DELEGATION_SERVICE_NAME) { + $Msg = "Can not use subnet with existing delegations other than {0}" -f $DELEGATION_SERVICE_NAME + throw $Msg + } } + } + else { + # Valid but no delegation + throw "Add delegation " + $DELEGATION_SERVICE_NAME + " to the subnet." + } + $PSBoundParameters.NetworkDelegatedSubnetResourceId = $PSBoundParameters.Subnet + $null = $PSBoundParameters.Remove('Subnet') + } + + if ($PSBoundParameters.ContainsKey('PrivateDnsZone')) { + if (!(Get-Module -ListAvailable -Name Az.PrivateDns)) { + throw 'Please install Az.Network module by entering "Install-Module -Name Az.PrivateDns"' + } + else { + Import-Module -Name Az.PrivateDns + } + if ([string]::IsNullOrEmpty($VnetId)) { + if ($server.NetworkPublicNetworkAccess -eq 'Enabled') { + throw "The source server is not private access enabled. Specify subnet ID if you want to restore it to public access server" + } + $VnetId = [string]::Join("/", $server.NetworkDelegatedSubnetResourceId.split("/")[0..8]) + } + $ZoneName = $PSBoundParameters["PrivateDnsZone"].split("/")[-1] + $DnsResourceGroup = $PSBoundParameters["PrivateDnsZone"].split("/")[4] + $Links = Get-AzPrivateDnsVirtualNetworkLink -ZoneName $ZoneName -ResourceGroupName $DnsResourceGroup + $LinkedFlag = $false + foreach ($Link in $Links) { + if ($Link.VirtualNetworkId -eq $VnetId) { + $LinkedFlag = $true + break + } + } + if (!$LinkedFlag) { + Write-Host "Adding virtual network link to the DNS zone..." + New-AzPrivateDnsVirtualNetworkLink -ZoneName $ZoneName -ResourceGroupName $DnsResourceGroup -Name $PSBoundParameters["Name"] -VirtualNetworkId $VnetId + } + $PSBoundParameters.NetworkPrivateDnsZoneResourceId = $PSBoundParameters.PrivateDnsZone + $null = $PSBoundParameters.Remove('PrivateDnsZone') + + } + + if ($PSBoundParameters.ContainsKey('Tag')) { + $PSBoundParameters.Tag = $PSBoundParameters['Tag'] + $null = $PSBoundParameters.Remove('Tag') + } + + Az.MySql.internal\New-AzMySqlFlexibleServer @PSBoundParameters + } + catch { + throw + } + } +} diff --git a/src/MySql/MySql.Autorest/docs/Az.MySql.md b/src/MySql/MySql.Autorest/docs/Az.MySql.md index 45d036ac1902..a2921aef1068 100644 --- a/src/MySql/MySql.Autorest/docs/Az.MySql.md +++ b/src/MySql/MySql.Autorest/docs/Az.MySql.md @@ -1,6 +1,6 @@ --- Module Name: Az.MySql -Module Guid: 9e6f7276-93b8-48dc-8c37-abd95fe7d667 +Module Guid: 21aee4b9-13aa-41fa-993f-0ea403b3fa72 Download Help Link: https://learn.microsoft.com/powershell/module/az.mysql Help Version: 1.0.0.0 Locale: en-US @@ -102,7 +102,7 @@ Restarts a server. Restarts a server. ### [Restore-AzMySqlFlexibleServer](Restore-AzMySqlFlexibleServer.md) -Restore a server from an existing backup +Restore a server from an existing backup using GeoRestore ### [Restore-AzMySqlServer](Restore-AzMySqlServer.md) Restore a server from an existing backup diff --git a/src/MySql/MySql.Autorest/docs/Restore-AzMySqlFlexibleServer.md b/src/MySql/MySql.Autorest/docs/Restore-AzMySqlFlexibleServer.md index d0556c169f6f..7c2d6de08b66 100644 --- a/src/MySql/MySql.Autorest/docs/Restore-AzMySqlFlexibleServer.md +++ b/src/MySql/MySql.Autorest/docs/Restore-AzMySqlFlexibleServer.md @@ -8,18 +8,26 @@ schema: 2.0.0 # Restore-AzMySqlFlexibleServer ## SYNOPSIS -Restore a server from an existing backup +Restore a server from an existing backup using GeoRestore ## SYNTAX +### PointInTimeRestore (Default) ``` Restore-AzMySqlFlexibleServer -Name -ResourceGroupName -InputObject -RestorePointInTime [-SubscriptionId ] [-PrivateDnsZone ] [-Subnet ] [-Zone ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] ``` +### GeoRestore +``` +Restore-AzMySqlFlexibleServer -Name -ResourceGroupName -InputObject + -Location -UseGeoRestore [-SubscriptionId ] [-Sku ] [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + ## DESCRIPTION -Restore a server from an existing backup +Restore a server from an existing backup using GeoRestore ## EXAMPLES @@ -99,6 +107,21 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` +### -Location +The location to restore the server to. + +```yaml +Type: System.String +Parameter Sets: GeoRestore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Name The name of the server. @@ -138,7 +161,7 @@ The suffix of dns zone has to be same as that of fully qualified domain of the s ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: PointInTimeRestore Aliases: Required: False @@ -149,7 +172,7 @@ Accept wildcard characters: False ``` ### -ResourceGroupName -The name of the resource group that contains the resource, You can obtain this value from the Azure Resource Manager API or the portal. +The name of the resource group that contains the resource. ```yaml Type: System.String @@ -168,7 +191,7 @@ The location the resource resides in. ```yaml Type: System.DateTime -Parameter Sets: (All) +Parameter Sets: PointInTimeRestore Aliases: Required: True @@ -178,6 +201,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Sku +The name of the sku, typically, tier + family + cores, e.g., B_Gen4_1, GP_Gen5_8. + +```yaml +Type: System.String +Parameter Sets: GeoRestore +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Subnet The id of an existing Subnet the private access server will created to. Please note that the subnet will be delegated to Microsoft.DBforMySQL/flexibleServers. @@ -185,7 +223,7 @@ After delegation, this subnet cannot be used for any other type of Azure resourc ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: PointInTimeRestore Aliases: Required: False @@ -210,12 +248,42 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Tag +Application-specific metadata in the form of key-value pairs. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: GeoRestore +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UseGeoRestore +Use Geo mode to restore + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: GeoRestore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Zone Availability zone into which to provision the resource. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: PointInTimeRestore Aliases: Required: False diff --git a/src/MySql/MySql.Autorest/generate-info.json b/src/MySql/MySql.Autorest/generate-info.json index 1d69d6e8727a..7dd7b9814e5a 100644 --- a/src/MySql/MySql.Autorest/generate-info.json +++ b/src/MySql/MySql.Autorest/generate-info.json @@ -1,3 +1,3 @@ { - "generate_Id": "1851936f-d0fd-4199-8061-4bf6bff6a286" + "generate_Id": "12ad3b53-39f6-4285-b94f-1f77795eecb8" } diff --git a/src/MySql/MySql.Autorest/resources/README.md b/src/MySql/MySql.Autorest/resources/README.md new file mode 100644 index 000000000000..937f07f8fec2 --- /dev/null +++ b/src/MySql/MySql.Autorest/resources/README.md @@ -0,0 +1,11 @@ +# Resources +This directory can contain any additional resources for module that are not required at runtime. This directory **does not** get packaged with the module. If you have assets for custom implementation, place them into the `..\custom` folder. + +## Info +- Modifiable: yes +- Generated: no +- Committed: yes +- Packaged: no + +## Purpose +Use this folder to put anything you want to keep around as part of the repository for the module, but is not something that is required for the module. For example, development files, packaged builds, or additional information. This is only intended to be used in repositories where the module's output directory is cleaned, but tangential resources for the module want to remain intact. \ No newline at end of file diff --git a/src/MySql/MySql.sln b/src/MySql/MySql.sln index 897549d91c8e..6b2e7b87fc76 100644 --- a/src/MySql/MySql.sln +++ b/src/MySql/MySql.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 @@ -19,49 +19,119 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accoun EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MySql", "MySql\MySql.csproj", "{286CC291-268F-4E04-85A8-1794BAAAF876}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.MySql", "..\..\generated\MySql\MySql.Autorest\Az.MySql.csproj", "{BE109346-A947-4081-BE2A-3057F6DFF782}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MySql.Autorest", "MySql.Autorest", "{3FAB33A8-DCB3-1E46-A31E-A4F2684A642B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.MySql", "..\..\generated\MySql\MySql.Autorest\Az.MySql.csproj", "{A4A51B9D-DC53-4905-BF5F-5CF681424D4C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {3814EE7A-27EB-4621-8059-027E1DDEA4B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3814EE7A-27EB-4621-8059-027E1DDEA4B5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3814EE7A-27EB-4621-8059-027E1DDEA4B5}.Debug|x64.ActiveCfg = Debug|Any CPU + {3814EE7A-27EB-4621-8059-027E1DDEA4B5}.Debug|x64.Build.0 = Debug|Any CPU + {3814EE7A-27EB-4621-8059-027E1DDEA4B5}.Debug|x86.ActiveCfg = Debug|Any CPU + {3814EE7A-27EB-4621-8059-027E1DDEA4B5}.Debug|x86.Build.0 = Debug|Any CPU {3814EE7A-27EB-4621-8059-027E1DDEA4B5}.Release|Any CPU.ActiveCfg = Release|Any CPU {3814EE7A-27EB-4621-8059-027E1DDEA4B5}.Release|Any CPU.Build.0 = Release|Any CPU + {3814EE7A-27EB-4621-8059-027E1DDEA4B5}.Release|x64.ActiveCfg = Release|Any CPU + {3814EE7A-27EB-4621-8059-027E1DDEA4B5}.Release|x64.Build.0 = Release|Any CPU + {3814EE7A-27EB-4621-8059-027E1DDEA4B5}.Release|x86.ActiveCfg = Release|Any CPU + {3814EE7A-27EB-4621-8059-027E1DDEA4B5}.Release|x86.Build.0 = Release|Any CPU {319AE486-99EF-4E72-A013-D9880E9BA9E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {319AE486-99EF-4E72-A013-D9880E9BA9E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {319AE486-99EF-4E72-A013-D9880E9BA9E5}.Debug|x64.ActiveCfg = Debug|Any CPU + {319AE486-99EF-4E72-A013-D9880E9BA9E5}.Debug|x64.Build.0 = Debug|Any CPU + {319AE486-99EF-4E72-A013-D9880E9BA9E5}.Debug|x86.ActiveCfg = Debug|Any CPU + {319AE486-99EF-4E72-A013-D9880E9BA9E5}.Debug|x86.Build.0 = Debug|Any CPU {319AE486-99EF-4E72-A013-D9880E9BA9E5}.Release|Any CPU.ActiveCfg = Release|Any CPU {319AE486-99EF-4E72-A013-D9880E9BA9E5}.Release|Any CPU.Build.0 = Release|Any CPU + {319AE486-99EF-4E72-A013-D9880E9BA9E5}.Release|x64.ActiveCfg = Release|Any CPU + {319AE486-99EF-4E72-A013-D9880E9BA9E5}.Release|x64.Build.0 = Release|Any CPU + {319AE486-99EF-4E72-A013-D9880E9BA9E5}.Release|x86.ActiveCfg = Release|Any CPU + {319AE486-99EF-4E72-A013-D9880E9BA9E5}.Release|x86.Build.0 = Release|Any CPU {7FF462A2-56A4-4511-BA52-AC9EE2703144}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7FF462A2-56A4-4511-BA52-AC9EE2703144}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7FF462A2-56A4-4511-BA52-AC9EE2703144}.Debug|x64.ActiveCfg = Debug|Any CPU + {7FF462A2-56A4-4511-BA52-AC9EE2703144}.Debug|x64.Build.0 = Debug|Any CPU + {7FF462A2-56A4-4511-BA52-AC9EE2703144}.Debug|x86.ActiveCfg = Debug|Any CPU + {7FF462A2-56A4-4511-BA52-AC9EE2703144}.Debug|x86.Build.0 = Debug|Any CPU {7FF462A2-56A4-4511-BA52-AC9EE2703144}.Release|Any CPU.ActiveCfg = Release|Any CPU {7FF462A2-56A4-4511-BA52-AC9EE2703144}.Release|Any CPU.Build.0 = Release|Any CPU + {7FF462A2-56A4-4511-BA52-AC9EE2703144}.Release|x64.ActiveCfg = Release|Any CPU + {7FF462A2-56A4-4511-BA52-AC9EE2703144}.Release|x64.Build.0 = Release|Any CPU + {7FF462A2-56A4-4511-BA52-AC9EE2703144}.Release|x86.ActiveCfg = Release|Any CPU + {7FF462A2-56A4-4511-BA52-AC9EE2703144}.Release|x86.Build.0 = Release|Any CPU {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC}.Debug|x64.ActiveCfg = Debug|Any CPU + {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC}.Debug|x64.Build.0 = Debug|Any CPU + {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC}.Debug|x86.ActiveCfg = Debug|Any CPU + {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC}.Debug|x86.Build.0 = Debug|Any CPU {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC}.Release|Any CPU.ActiveCfg = Release|Any CPU {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC}.Release|Any CPU.Build.0 = Release|Any CPU + {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC}.Release|x64.ActiveCfg = Release|Any CPU + {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC}.Release|x64.Build.0 = Release|Any CPU + {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC}.Release|x86.ActiveCfg = Release|Any CPU + {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC}.Release|x86.Build.0 = Release|Any CPU {9AD18BB2-11C1-419A-91EA-1EA71A275200}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9AD18BB2-11C1-419A-91EA-1EA71A275200}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9AD18BB2-11C1-419A-91EA-1EA71A275200}.Debug|x64.ActiveCfg = Debug|Any CPU + {9AD18BB2-11C1-419A-91EA-1EA71A275200}.Debug|x64.Build.0 = Debug|Any CPU + {9AD18BB2-11C1-419A-91EA-1EA71A275200}.Debug|x86.ActiveCfg = Debug|Any CPU + {9AD18BB2-11C1-419A-91EA-1EA71A275200}.Debug|x86.Build.0 = Debug|Any CPU {9AD18BB2-11C1-419A-91EA-1EA71A275200}.Release|Any CPU.ActiveCfg = Release|Any CPU {9AD18BB2-11C1-419A-91EA-1EA71A275200}.Release|Any CPU.Build.0 = Release|Any CPU + {9AD18BB2-11C1-419A-91EA-1EA71A275200}.Release|x64.ActiveCfg = Release|Any CPU + {9AD18BB2-11C1-419A-91EA-1EA71A275200}.Release|x64.Build.0 = Release|Any CPU + {9AD18BB2-11C1-419A-91EA-1EA71A275200}.Release|x86.ActiveCfg = Release|Any CPU + {9AD18BB2-11C1-419A-91EA-1EA71A275200}.Release|x86.Build.0 = Release|Any CPU {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861}.Debug|x64.ActiveCfg = Debug|Any CPU + {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861}.Debug|x64.Build.0 = Debug|Any CPU + {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861}.Debug|x86.ActiveCfg = Debug|Any CPU + {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861}.Debug|x86.Build.0 = Debug|Any CPU {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861}.Release|Any CPU.ActiveCfg = Release|Any CPU {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861}.Release|Any CPU.Build.0 = Release|Any CPU + {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861}.Release|x64.ActiveCfg = Release|Any CPU + {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861}.Release|x64.Build.0 = Release|Any CPU + {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861}.Release|x86.ActiveCfg = Release|Any CPU + {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861}.Release|x86.Build.0 = Release|Any CPU {286CC291-268F-4E04-85A8-1794BAAAF876}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {286CC291-268F-4E04-85A8-1794BAAAF876}.Debug|Any CPU.Build.0 = Debug|Any CPU + {286CC291-268F-4E04-85A8-1794BAAAF876}.Debug|x64.ActiveCfg = Debug|Any CPU + {286CC291-268F-4E04-85A8-1794BAAAF876}.Debug|x64.Build.0 = Debug|Any CPU + {286CC291-268F-4E04-85A8-1794BAAAF876}.Debug|x86.ActiveCfg = Debug|Any CPU + {286CC291-268F-4E04-85A8-1794BAAAF876}.Debug|x86.Build.0 = Debug|Any CPU {286CC291-268F-4E04-85A8-1794BAAAF876}.Release|Any CPU.ActiveCfg = Release|Any CPU {286CC291-268F-4E04-85A8-1794BAAAF876}.Release|Any CPU.Build.0 = Release|Any CPU - {BE109346-A947-4081-BE2A-3057F6DFF782}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BE109346-A947-4081-BE2A-3057F6DFF782}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BE109346-A947-4081-BE2A-3057F6DFF782}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BE109346-A947-4081-BE2A-3057F6DFF782}.Release|Any CPU.Build.0 = Release|Any CPU + {286CC291-268F-4E04-85A8-1794BAAAF876}.Release|x64.ActiveCfg = Release|Any CPU + {286CC291-268F-4E04-85A8-1794BAAAF876}.Release|x64.Build.0 = Release|Any CPU + {286CC291-268F-4E04-85A8-1794BAAAF876}.Release|x86.ActiveCfg = Release|Any CPU + {286CC291-268F-4E04-85A8-1794BAAAF876}.Release|x86.Build.0 = Release|Any CPU + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C}.Debug|x64.ActiveCfg = Debug|Any CPU + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C}.Debug|x64.Build.0 = Debug|Any CPU + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C}.Debug|x86.ActiveCfg = Debug|Any CPU + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C}.Debug|x86.Build.0 = Debug|Any CPU + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C}.Release|Any CPU.Build.0 = Release|Any CPU + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C}.Release|x64.ActiveCfg = Release|Any CPU + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C}.Release|x64.Build.0 = Release|Any CPU + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C}.Release|x86.ActiveCfg = Release|Any CPU + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {3814EE7A-27EB-4621-8059-027E1DDEA4B5} = {2FFC8559-B8D4-4C7B-8B15-AEECEFA2F290} @@ -70,5 +140,6 @@ Global {BA5D2B5D-7F4D-4A92-B035-8F737578F3BC} = {2FFC8559-B8D4-4C7B-8B15-AEECEFA2F290} {9AD18BB2-11C1-419A-91EA-1EA71A275200} = {2FFC8559-B8D4-4C7B-8B15-AEECEFA2F290} {A5A6C5E0-EC4D-44BA-8C5A-2D6CAC21D861} = {2FFC8559-B8D4-4C7B-8B15-AEECEFA2F290} + {A4A51B9D-DC53-4905-BF5F-5CF681424D4C} = {3FAB33A8-DCB3-1E46-A31E-A4F2684A642B} EndGlobalSection EndGlobal diff --git a/src/MySql/MySql/Az.MySql.psd1 b/src/MySql/MySql/Az.MySql.psd1 index 3b2b9bd8cb82..88854d8a09fb 100644 --- a/src/MySql/MySql/Az.MySql.psd1 +++ b/src/MySql/MySql/Az.MySql.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 1/9/2025 +# Generated on: 5/11/2025 # @{ @@ -51,16 +51,16 @@ DotNetFrameworkVersion = '4.7.2' # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '4.0.1'; }) +RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '4.2.0'; }) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = 'MySql.Autorest/bin/Az.MySql.private.dll' # Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() +ScriptsToProcess = @() # Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() +TypesToProcess = @() # Format files (.ps1xml) to be loaded when importing this module FormatsToProcess = 'MySql.Autorest/Az.MySql.format.ps1xml' @@ -123,7 +123,7 @@ PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. - Tags = 'Azure','ResourceManager','ARM','PSModule','MySql' + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'MySql' # A URL to the license for this module. LicenseUri = 'https://aka.ms/azps-license' @@ -148,7 +148,7 @@ PrivateData = @{ } # End of PSData hashtable - } # End of PrivateData hashtable +} # End of PrivateData hashtable # HelpInfo URI of this module # HelpInfoURI = '' diff --git a/src/MySql/MySql/ChangeLog.md b/src/MySql/MySql/ChangeLog.md index 97f7613cc075..d77014eee51c 100644 --- a/src/MySql/MySql/ChangeLog.md +++ b/src/MySql/MySql/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +- Enhanced `Restore-AzMySqlFlexibleServer` functionality with GeoRestore support ## Version 1.3.0 * Upgraded nuget package to signed package. diff --git a/src/MySql/MySql/help/Az.MySql.md b/src/MySql/MySql/help/Az.MySql.md index 5997595f175c..6eb0a689f667 100644 --- a/src/MySql/MySql/help/Az.MySql.md +++ b/src/MySql/MySql/help/Az.MySql.md @@ -102,7 +102,7 @@ Restarts a server. Restarts a server. ### [Restore-AzMySqlFlexibleServer](Restore-AzMySqlFlexibleServer.md) -Restore a server from an existing backup +Restore a server from an existing backup using GeoRestore ### [Restore-AzMySqlServer](Restore-AzMySqlServer.md) Restore a server from an existing backup diff --git a/src/MySql/MySql/help/New-AzMySqlFlexibleServer.md b/src/MySql/MySql/help/New-AzMySqlFlexibleServer.md index 466d1896775d..1f8ea93b2b3c 100644 --- a/src/MySql/MySql/help/New-AzMySqlFlexibleServer.md +++ b/src/MySql/MySql/help/New-AzMySqlFlexibleServer.md @@ -29,7 +29,7 @@ Creates a new MySQL flexible server. ### Example 1: Create a new MySql flexible server with arguments ```powershell -$password = ConvertTo-SecureString -String "****" -AsPlainText -Force +$password = ConvertTo-SecureString -String "1234" -Force -AsPlainText New-AzMySqlFlexibleServer -Name mysql-test -ResourceGroupName PowershellMySqlTest -Location eastus -AdministratorUserName mysqltest -AdministratorLoginPassword $password -Sku Standard_D2ds_v4 -SkuTier Burstable -Version 12 -StorageInMb 20480 -PublicAccess none -Zone 1 -BackupRetentionDay 10 -StorageAutogrow Enabled -Iops 500 -HighAvailability ZoneRedundant ``` diff --git a/src/MySql/MySql/help/New-AzMySqlServer.md b/src/MySql/MySql/help/New-AzMySqlServer.md index 1a4ac446ec65..1f4b7581f2d5 100644 --- a/src/MySql/MySql/help/New-AzMySqlServer.md +++ b/src/MySql/MySql/help/New-AzMySqlServer.md @@ -28,7 +28,7 @@ Creates a new server. ### Example 1: Create a new MySql server ```powershell -$password = ConvertTo-SecureString -String "****" -AsPlainText -Force +$password = ConvertTo-SecureString -String "1234" -Force -AsPlainText New-AzMySqlServer -Name mysql-test -ResourceGroupName PowershellMySqlTest -Location eastus -AdministratorUserName mysql_test -AdministratorLoginPassword $password -Sku GP_Gen5_4 ``` diff --git a/src/MySql/MySql/help/Restore-AzMySqlFlexibleServer.md b/src/MySql/MySql/help/Restore-AzMySqlFlexibleServer.md index 53ee4a2da1c9..24fbc1dc7440 100644 --- a/src/MySql/MySql/help/Restore-AzMySqlFlexibleServer.md +++ b/src/MySql/MySql/help/Restore-AzMySqlFlexibleServer.md @@ -8,19 +8,28 @@ schema: 2.0.0 # Restore-AzMySqlFlexibleServer ## SYNOPSIS -Restore a server from an existing backup +Restore a server from an existing backup using GeoRestore ## SYNTAX +### PointInTimeRestore (Default) ``` Restore-AzMySqlFlexibleServer -Name -ResourceGroupName [-SubscriptionId ] - -RestorePointInTime -InputObject [-Zone ] [-Subnet ] + -InputObject -RestorePointInTime [-Zone ] [-Subnet ] [-PrivateDnsZone ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] ``` +### GeoRestore +``` +Restore-AzMySqlFlexibleServer -Name -ResourceGroupName [-SubscriptionId ] + -InputObject -Location [-UseGeoRestore] [-Sku ] [-Tag ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] + [] +``` + ## DESCRIPTION -Restore a server from an existing backup +Restore a server from an existing backup using GeoRestore ## EXAMPLES @@ -100,6 +109,21 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` +### -Location +The location to restore the server to. + +```yaml +Type: System.String +Parameter Sets: GeoRestore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Name The name of the server. @@ -139,7 +163,7 @@ The suffix of dns zone has to be same as that of fully qualified domain of the s ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: PointInTimeRestore Aliases: Required: False @@ -150,7 +174,7 @@ Accept wildcard characters: False ``` ### -ResourceGroupName -The name of the resource group that contains the resource, You can obtain this value from the Azure Resource Manager API or the portal. +The name of the resource group that contains the resource. ```yaml Type: System.String @@ -169,7 +193,7 @@ The location the resource resides in. ```yaml Type: System.DateTime -Parameter Sets: (All) +Parameter Sets: PointInTimeRestore Aliases: Required: True @@ -179,6 +203,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Sku +The name of the sku, typically, tier + family + cores, e.g., B_Gen4_1, GP_Gen5_8. + +```yaml +Type: System.String +Parameter Sets: GeoRestore +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Subnet The id of an existing Subnet the private access server will created to. Please note that the subnet will be delegated to Microsoft.DBforMySQL/flexibleServers. @@ -186,7 +225,7 @@ After delegation, this subnet cannot be used for any other type of Azure resourc ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: PointInTimeRestore Aliases: Required: False @@ -211,12 +250,42 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Tag +Application-specific metadata in the form of key-value pairs. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: GeoRestore +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UseGeoRestore +Use Geo mode to restore + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: GeoRestore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Zone Availability zone into which to provision the resource. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: PointInTimeRestore Aliases: Required: False diff --git a/src/MySql/MySql/help/Test-AzMySqlFlexibleServerConnect.md b/src/MySql/MySql/help/Test-AzMySqlFlexibleServerConnect.md index dae7420894bd..c5c2d1dba04e 100644 --- a/src/MySql/MySql/help/Test-AzMySqlFlexibleServerConnect.md +++ b/src/MySql/MySql/help/Test-AzMySqlFlexibleServerConnect.md @@ -47,7 +47,7 @@ Test out the connection to the database server ### Example 1: Test connection by name ```powershell -$password = ConvertTo-SecureString -String "****" -AsPlainText -Force +$password = ConvertTo-SecureString -AsPlainText Test-AzMySqlFlexibleServerConnect -ResourceGroupName PowershellMySqlTest -Name mysql-test -AdministratorLoginPassword $password ``` @@ -59,7 +59,7 @@ Test connection by the resource group and the server name ### Example 2: Test connection by identity ```powershell -$password = ConvertTo-SecureString -String "****" -AsPlainText -Force +$password = ConvertTo-SecureString -AsPlainText Get-AzMySqlFlexibleServer -ResourceGroupName PowershellMySqlTest -ServerName mysql-test | Test-AzMySqlFlexibleServerConnect -AdministratorLoginPassword $password ``` @@ -71,7 +71,7 @@ Test connection by the identity ### Example 3: Test query by name ```powershell -$password = ConvertTo-SecureString -String "****" -AsPlainText -Force +$password = ConvertTo-SecureString -AsPlainText Test-AzMySqlFlexibleServerConnect -ResourceGroupName PowershellMySqlTest -Name mysql-test -AdministratorLoginPassword $password -QueryText "SELECT * FROM test" ```