Skip to content

[PS] Migrate MySQL module to autorest v4#29562

Closed
khang-11 wants to merge 9 commits into
Azure:mainfrom
khang-11:recreate/pr-28784
Closed

[PS] Migrate MySQL module to autorest v4#29562
khang-11 wants to merge 9 commits into
Azure:mainfrom
khang-11:recreate/pr-28784

Conversation

@khang-11

Copy link
Copy Markdown
Contributor

Description

Preannouncement PR:

  1. [PS] Mysql module migration autorest v4 breaking change announcement #28788
  2. [BC]MySQL Update Release Date to May 2026 #29120

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copilot AI review requested due to automatic review settings May 12, 2026 03:32
@azure-client-tools-bot-prd

Copy link
Copy Markdown
Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the Az.MySql module to AutoRest PowerShell v4, updating the generated surface area (help/docs/types/tests) and removing legacy single-server artifacts as part of the announced breaking-change track.

Changes:

  • Updated cmdlet help/docs to reflect new model/interface types and new/updated parameter sets (including JSON input parameter sets).
  • Removed legacy “single server” cmdlets’ help/examples/tests/UX metadata, keeping the module focused on flexible server cmdlets.
  • Updated custom cmdlet wrappers and test infrastructure to align with the new generated internals and module layout.

Reviewed changes

Copilot reviewed 138 out of 217 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/MySql/MySql/help/Update-AzMySqlFlexibleServerFirewallRule.md Help output type updated to v4 model interface
src/MySql/MySql/help/Update-AzMySqlFlexibleServerConfiguration.md Help output type updated to v4 model interface
src/MySql/MySql/help/Update-AzMySqlFlexibleServerAdvancedThreatProtectionSetting.md Help updated for new parameter sets/types
src/MySql/MySql/help/Update-AzMySqlFlexibleServer.md Help updated for v4 parameter types/output
src/MySql/MySql/help/Test-AzMySqlFlexibleServerConnect.md Help identity text adjusted
src/MySql/MySql/help/Stop-AzMySqlFlexibleServer.md Help identity text adjusted
src/MySql/MySql/help/Start-AzMySqlFlexibleServer.md Help identity text adjusted
src/MySql/MySql/help/Restore-AzMySqlFlexibleServer.md Help model types updated
src/MySql/MySql/help/Restart-AzMySqlFlexibleServer.md Help updated for new parameter sets/types
src/MySql/MySql/help/Remove-AzMySqlFlexibleServerFirewallRule.md Help updated for added identity parameter set
src/MySql/MySql/help/Remove-AzMySqlFlexibleServerDatabase.md Help updated for added identity parameter set
src/MySql/MySql/help/Remove-AzMySqlFlexibleServer.md Help identity text adjusted
src/MySql/MySql/help/New-AzMySqlFlexibleServerReplica.md Help model types updated
src/MySql/MySql/help/New-AzMySqlFlexibleServerFirewallRule.md Help output type updated to v4 model interface
src/MySql/MySql/help/New-AzMySqlFlexibleServer.md Help updated for v4 parameter types/output
src/MySql/MySql/help/Get-AzMySqlVirtualNetworkRule.md Legacy single-server help removed
src/MySql/MySql/help/Get-AzMySqlReplica.md Legacy single-server help removed
src/MySql/MySql/help/Get-AzMySqlFlexibleServerReplica.md Help output type updated to v4 model interface
src/MySql/MySql/help/Get-AzMySqlFlexibleServerLocationBasedCapability.md Help model types updated
src/MySql/MySql/help/Get-AzMySqlFlexibleServerFirewallRule.md Help updated for added identity parameter set/output type
src/MySql/MySql/help/Get-AzMySqlFlexibleServerDatabase.md Help updated for added identity parameter set/output type
src/MySql/MySql/help/Get-AzMySqlFlexibleServerConnectionString.md Help identity text adjusted
src/MySql/MySql/help/Get-AzMySqlFlexibleServerConfiguration.md Help updated for added identity parameter set/output type
src/MySql/MySql/help/Get-AzMySqlFlexibleServerAdvancedThreatProtectionSetting.md Help output type updated to v4 model interface
src/MySql/MySql/help/Get-AzMySqlFlexibleServer.md Help output type updated to v4 model interface
src/MySql/MySql/help/Get-AzMySqlFirewallRule.md Legacy single-server help removed
src/MySql/MySql/help/Get-AzMySqlConnectionString.md Legacy single-server help removed
src/MySql/MySql/help/Get-AzMySqlConfiguration.md Legacy single-server help removed
src/MySql/MySql/help/Az.MySql.md Module index updated to remove legacy cmdlets
src/MySql/MySql/ChangeLog.md Added upcoming-release note for migration/breaking changes
src/MySql/MySql/Az.MySql.psd1 Updated exports/manifest fields for v4 module shape
src/MySql/MySql.Autorest/UX/Microsoft.DBforMySQL/servers.json Removed legacy single-server UX metadata
src/MySql/MySql.Autorest/UX/Microsoft.DBforMySQL/servers-virtualNetworkRules.json Removed legacy single-server UX metadata
src/MySql/MySql.Autorest/UX/Microsoft.DBforMySQL/servers-firewallRules.json Removed legacy single-server UX metadata
src/MySql/MySql.Autorest/UX/Microsoft.DBforMySQL/servers-configurations.json Removed legacy single-server UX metadata
src/MySql/MySql.Autorest/UX/Microsoft.DBforMySQL/flexibleServers.json Removed/adjusted flexible server UX command metadata
src/MySql/MySql.Autorest/test/utils.ps1 Updated test env provisioning and randomness
src/MySql/MySql.Autorest/test/Update-AzMySqlVirtualNetworkRule.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Update-AzMySqlServerConfigurationsList.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Update-AzMySqlServer.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Update-AzMySqlFlexibleServerAdvancedThreatProtectionSetting.Tests.ps1 Added placeholder tests for new JSON parameter sets
src/MySql/MySql.Autorest/test/Update-AzMySqlFirewallRule.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Update-AzMySqlConfiguration.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Test-AzMySqlFlexibleServerConnect.Tests.ps1 Updated/connectivity test scenarios for flexible server
src/MySql/MySql.Autorest/test/Set-AzMySqlAdvancedThreatProtectionSettingPut.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Restore-AzMySqlServer.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Restore-AzMySqlFlexibleServer.Tests.ps1 Added placeholder for GeoRestore test
src/MySql/MySql.Autorest/test/Restart-AzMySqlServer.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Restart-AzMySqlFlexibleServer.Tests.ps1 Added placeholder tests for new JSON parameter sets
src/MySql/MySql.Autorest/test/Remove-AzMySqlVirtualNetworkRule.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Remove-AzMySqlServer.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Remove-AzMySqlFlexibleServerFirewallRule.Tests.ps1 Added placeholder for new identity parameter set
src/MySql/MySql.Autorest/test/Remove-AzMySqlFlexibleServerDatabase.Tests.ps1 Added placeholder for new identity parameter set
src/MySql/MySql.Autorest/test/Remove-AzMySqlFirewallRule.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/New-AzMySqlVirtualNetworkRule.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/New-AzMySqlServer.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/New-AzMySqlReplica.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/New-AzMySqlFlexibleServerDatabase.Tests.ps1 Added placeholder tests for new JSON/identity parameter sets
src/MySql/MySql.Autorest/test/New-AzMySqlFirewallRule.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/localEnv.json Updated local live-test environment template
src/MySql/MySql.Autorest/test/env.json Updated env template values for tests
src/MySql/MySql.Autorest/test/Get-AzMySqlVirtualNetworkRule.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Get-AzMySqlServer.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Get-AzMySqlReplica.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Get-AzMySqlFlexibleServerFirewallRule.Tests.ps1 Added placeholder for new identity parameter set
src/MySql/MySql.Autorest/test/Get-AzMySqlFlexibleServerDatabase.Tests.ps1 Added placeholder for new identity parameter set
src/MySql/MySql.Autorest/test/Get-AzMySqlFlexibleServerConfiguration.Tests.ps1 Added placeholder for new identity parameter set
src/MySql/MySql.Autorest/test/Get-AzMySqlFlexibleServerAdvancedThreatProtectionSetting.Tests.ps1 Updated placeholder test name
src/MySql/MySql.Autorest/test/Get-AzMySqlFlexibleServer.Tests.ps1 Reordered placeholder tests
src/MySql/MySql.Autorest/test/Get-AzMySqlFirewallRule.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Get-AzMySqlConnectionString.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/Get-AzMySqlConfiguration.Tests.ps1 Removed legacy single-server test
src/MySql/MySql.Autorest/test/AzMySqlFlexibleServerFirewallRule.Tests.ps1 Minor test formatting cleanup
src/MySql/MySql.Autorest/test/AzMySqlFlexibleServerDatabase.Tests.ps1 Updated DB creation to include collation
src/MySql/MySql.Autorest/test/AzMySqlFlexibleServer.Tests.ps1 Updated flexible server scenario expectations/IDs
src/MySql/MySql.Autorest/Properties/AssemblyInfo.cs Version bump to 1.5.2
src/MySql/MySql.Autorest/generate-info.json Updated generation ID
src/MySql/MySql.Autorest/examples/Update-AzMySqlVirtualNetworkRule.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Update-AzMySqlServerConfigurationsList.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Update-AzMySqlServer.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Update-AzMySqlFlexibleServerFirewallRule.md Formatting-only tweak
src/MySql/MySql.Autorest/examples/Update-AzMySqlFlexibleServerConfiguration.md Formatting-only tweak
src/MySql/MySql.Autorest/examples/Update-AzMySqlFlexibleServer.md Formatting-only tweak
src/MySql/MySql.Autorest/examples/Update-AzMySqlFirewallRule.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Update-AzMySqlConfiguration.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Restore-AzMySqlServer.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Restore-AzMySqlFlexibleServer.md Formatting-only tweak
src/MySql/MySql.Autorest/examples/Restart-AzMySqlServer.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Remove-AzMySqlVirtualNetworkRule.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Remove-AzMySqlServer.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Remove-AzMySqlFirewallRule.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/New-AzMySqlVirtualNetworkRule.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/New-AzMySqlServer.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/New-AzMySqlReplica.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/New-AzMySqlFlexibleServerReplica.md Formatting-only tweak
src/MySql/MySql.Autorest/examples/New-AzMySqlFlexibleServer.md Formatting-only tweak
src/MySql/MySql.Autorest/examples/New-AzMySqlFirewallRule.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Get-AzMySqlVirtualNetworkRule.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Get-AzMySqlServer.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Get-AzMySqlReplica.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Get-AzMySqlFlexibleServerConnectionString.md Formatting-only tweak
src/MySql/MySql.Autorest/examples/Get-AzMySqlFirewallRule.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Get-AzMySqlConnectionString.md Removed legacy single-server example
src/MySql/MySql.Autorest/examples/Get-AzMySqlConfiguration.md Removed legacy single-server example
src/MySql/MySql.Autorest/docs/Update-AzMySqlFlexibleServerFirewallRule.md Docs output type updated to v4 model interface
src/MySql/MySql.Autorest/docs/Update-AzMySqlFlexibleServerConfiguration.md Docs output type updated to v4 model interface
src/MySql/MySql.Autorest/docs/Update-AzMySqlFlexibleServerAdvancedThreatProtectionSetting.md Docs updated for new parameter sets/types
src/MySql/MySql.Autorest/docs/Update-AzMySqlFlexibleServer.md Docs updated for v4 parameter types/output
src/MySql/MySql.Autorest/docs/Test-AzMySqlFlexibleServerConnect.md Docs identity text adjusted
src/MySql/MySql.Autorest/docs/Stop-AzMySqlFlexibleServer.md Docs identity text adjusted
src/MySql/MySql.Autorest/docs/Start-AzMySqlFlexibleServer.md Docs identity text adjusted
src/MySql/MySql.Autorest/docs/Restore-AzMySqlFlexibleServer.md Docs model types updated
src/MySql/MySql.Autorest/docs/Restart-AzMySqlFlexibleServer.md Docs updated for new parameter sets/types
src/MySql/MySql.Autorest/docs/Remove-AzMySqlFlexibleServerFirewallRule.md Docs updated for added identity parameter set
src/MySql/MySql.Autorest/docs/Remove-AzMySqlFlexibleServerDatabase.md Docs updated for added identity parameter set
src/MySql/MySql.Autorest/docs/Remove-AzMySqlFlexibleServer.md Docs identity text adjusted
src/MySql/MySql.Autorest/docs/New-AzMySqlFlexibleServerReplica.md Docs model types updated
src/MySql/MySql.Autorest/docs/New-AzMySqlFlexibleServerFirewallRule.md Docs output type updated to v4 model interface
src/MySql/MySql.Autorest/docs/New-AzMySqlFlexibleServerDatabase.md Docs updated for new parameter sets/types
src/MySql/MySql.Autorest/docs/New-AzMySqlFlexibleServer.md Docs updated for v4 parameter types/output
src/MySql/MySql.Autorest/docs/Get-AzMySqlVirtualNetworkRule.md Legacy single-server docs removed
src/MySql/MySql.Autorest/docs/Get-AzMySqlReplica.md Legacy single-server docs removed
src/MySql/MySql.Autorest/docs/Get-AzMySqlFlexibleServerReplica.md Docs output type updated to v4 model interface
src/MySql/MySql.Autorest/docs/Get-AzMySqlFlexibleServerLocationBasedCapability.md Docs model types updated
src/MySql/MySql.Autorest/docs/Get-AzMySqlFlexibleServerFirewallRule.md Docs updated for added identity parameter set/output type
src/MySql/MySql.Autorest/docs/Get-AzMySqlFlexibleServerDatabase.md Docs updated for added identity parameter set/output type
src/MySql/MySql.Autorest/docs/Get-AzMySqlFlexibleServerConnectionString.md Docs identity text adjusted
src/MySql/MySql.Autorest/docs/Get-AzMySqlFlexibleServerConfiguration.md Docs updated for added identity parameter set/output type
src/MySql/MySql.Autorest/docs/Get-AzMySqlFlexibleServerAdvancedThreatProtectionSetting.md Docs output type updated to v4 model interface
src/MySql/MySql.Autorest/docs/Get-AzMySqlFlexibleServer.md Docs output type updated to v4 model interface
src/MySql/MySql.Autorest/docs/Get-AzMySqlFirewallRule.md Legacy single-server docs removed
src/MySql/MySql.Autorest/docs/Get-AzMySqlConnectionString.md Legacy single-server docs removed
src/MySql/MySql.Autorest/docs/Get-AzMySqlConfiguration.md Legacy single-server docs removed
src/MySql/MySql.Autorest/custom/Update-AzMySqlFlexibleServerFirewallRule.ps1 Output type updated to v4 model interface
src/MySql/MySql.Autorest/custom/Update-AzMySqlFlexibleServerConfiguration.ps1 Output type updated to v4 model interface
src/MySql/MySql.Autorest/custom/Update-AzMySqlFlexibleServer.ps1 Wrapper updated for v4 types/argument completers
src/MySql/MySql.Autorest/custom/Update-AzMySqlConfiguration.ps1 Legacy single-server wrapper removed
src/MySql/MySql.Autorest/custom/Test-AzMySqlFlexibleServerConnect.ps1 Updated server retrieval and error behavior
src/MySql/MySql.Autorest/custom/Restore-AzMySqlFlexibleServer_PointInTimeRestore.ps1 Output type and CreateMode updated for v4
src/MySql/MySql.Autorest/custom/Restore-AzMySqlFlexibleServer_GeoRestore.ps1 Output type and CreateMode updated for v4
src/MySql/MySql.Autorest/custom/New-AzMySqlFlexibleServerReplica.ps1 Output type and CreateMode updated for v4
src/MySql/MySql.Autorest/custom/New-AzMySqlFlexibleServerFirewallRule.ps1 Output type updated to v4 model interface
src/MySql/MySql.Autorest/custom/Get-AzMySqlFlexibleServerLocationBasedCapability.ps1 Output type updated to v4 model interface
src/MySql/MySql.Autorest/custom/FlexibleServer.cs Renamed/moved model partial class for v4
Comments suppressed due to low confidence (1)

src/MySql/MySql.Autorest/custom/Update-AzMySqlFlexibleServer.ps1:80

  • -HighAvailability is exposed as a parameter, but this wrapper no longer maps it to the request property used by the service (e.g., HighAvailabilityMode). In this module, New-AzMySqlFlexibleServer still performs that mapping, so Update-AzMySqlFlexibleServer may end up passing an unrecognized parameter to the internal cmdlet or failing to update HA settings. Consider adding the same translation logic here (and removing HighAvailability from PSBoundParameters).
        [Parameter(HelpMessage = 'Enable or disable high availability feature.  Default value is Disabled. Default: Disabled.')]
        [Microsoft.Azure.PowerShell.Cmdlets.MySql.PSArgumentCompleterAttribute("Disabled", "ZoneRedundant", "SameZone")]
        [Validateset('ZoneRedundant', 'SameZone', 'Disabled')]
        [Alias('HaEnabled')]
        [System.String]
        ${HighAvailability},

try {
if ($PSBoundParameters.ContainsKey('StorageInMb')) {
$PSBoundParameters.StorageSizeGb = [Math]::floor($PSBoundParameters['StorageInMb'] / 1024)
$gb = [int]([Math]::Ceiling($PSBoundParameters['StorageInMb'] / 1024))
Comment on lines 186 to 187
$null = $PSBoundParameters.Remove('Iops')
}
Comment on lines +151 to +159

if ($PSBoundParameters.ContainsKey('InputObject')) {
Write-Host $PSBoundParameters
$Server = Az.MySql.private\Get-AzMySqlFlexibleServer_GetViaIdentity @PSBoundParameters
}
else {
$SubscriptionId = (Get-AzContext).Subscription.Id
$PSBoundParameters['SubscriptionId'] = $SubscriptionId
Write-Host $PSBoundParameters
Comment on lines +101 to 106
# Create the test Vnet
write-host "Deploy Vnet template"
New-AzDeployment -Mode Incremental -TemplateFile .\test\deployment-templates\virtual-network\template.json -TemplateParameterFile .\test\deployment-templates\virtual-network\parameters.json -Name vn -ResourceGroupName $resourceGroup

Install-Module -Name SimplySQL -Scope CurrentUser -Force

Comment on lines +17 to +22
$flexibleServerName = 'mysql-flexible-test-400'

Describe 'Test-AzMySqlFlexibleServerConnect' -Tag 'LiveOnly' {
It 'Create' {
New-AzMySqlFlexibleServer -Name $flexibleServerName -ResourceGroupName $env.resourceGroup -AdministratorUserName mysql_test -AdministratorLoginPassword ($env.password | ConvertTo-SecureString -AsPlainText -Force) -Location $env.location -SkuTier GeneralPurpose -Sku Standard_D2ads_v5 -PublicAccess All
}
Comment on lines 10 to 12
## SYNOPSIS
Creates a new database or updates an existing database.
Create a new database or create an existing database.

Comment on lines 41 to +42
### [New-AzMySqlFlexibleServerDatabase](New-AzMySqlFlexibleServerDatabase.md)
Creates a new database or updates an existing database.
Create a new database or create an existing database.
Comment on lines 20 to +21
## Upcoming Release
* Improved user experience and consistency. This may introduce breaking changes. Please refer to [here](https://go.microsoft.com/fwlink/?linkid=2340249).
@YanaXu YanaXu added the autorest v4 migration pr migrating module from generated by autorest.powershell v3 to v4 label May 14, 2026
@Pan-Qi

Pan-Qi commented May 22, 2026

Copy link
Copy Markdown
Contributor

Already merged in PR #28695

@Pan-Qi Pan-Qi closed this May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autorest v4 migration pr migrating module from generated by autorest.powershell v3 to v4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants