Skip to content

[MySQL] az mysql flexible-server mirroring enable/disable: Support Fabric Mirroring#33774

Open
mohitsinha-ms wants to merge 6 commits into
Azure:devfrom
mohitsinha-ms:mohit/fabric-mirroring-cli-fix
Open

[MySQL] az mysql flexible-server mirroring enable/disable: Support Fabric Mirroring#33774
mohitsinha-ms wants to merge 6 commits into
Azure:devfrom
mohitsinha-ms:mohit/fabric-mirroring-cli-fix

Conversation

@mohitsinha-ms

@mohitsinha-ms mohitsinha-ms commented Jul 23, 2026

Copy link
Copy Markdown
Member

Related command
az mysql flexible-server mirroring enable / az mysql flexible-server mirroring disable

Description
Adds CLI support for Microsoft Fabric Mirroring on Azure Database for MySQL Flexible Server via a new mirroring subgroup:

  • az mysql flexible-server mirroring enable -g <rg> -n <server> --identity-resource-id <uami>
  • az mysql flexible-server mirroring disable -g <rg> -n <server>

These wrap the fabricMirroringSettings/Default ARM resource (API version 2025-12-01-preview, added in Azure/azure-rest-api-specs#39083), an async PUT with state = Enabled|Disabled and a user-assigned managed identity.

This PR also bumps azure-mgmt-mysqlflexibleservers 1.1.0b21.1.0b3, the first SDK version exposing FabricMirroringSettingsOperations (begin_create_or_update, get, list_by_server); without it the command fails with AttributeError: 'MySQLManagementClient' object has no attribute 'fabric_mirroring_settings'. It also fixes the request-body construction in custom.py to match the 1.1.0b3 model (nested properties.state / properties.identityResourceId). Supersedes #32708.

Testing Guide
Prerequisites: register the preview feature (az feature register --namespace Microsoft.DBforMySQL --name enableFabricMirroring_public then az provider register --namespace Microsoft.DBforMySQL); a non-HA General Purpose MySQL 8.0 server with binlog_row_image=FULL (or NOBLOB), gtid_mode=OFF, aad_auth_only=OFF; and a user-assigned managed identity attached to the server.

# Enable Fabric Mirroring
az mysql flexible-server mirroring enable -g <rg> -n <server> \
  --identity-resource-id /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<uami>
# -> returns the Default setting with "state": "Enabled", "provisioningState": "Succeeded"

# Disable Fabric Mirroring
az mysql flexible-server mirroring disable -g <rg> -n <server>
# -> returns "state": "Disabled", "provisioningState": "Succeeded"

Verified end-to-end against a live server (enable → Enabled, disable → Disabled). Automated scenario test added in test_mysql_scenario.py.

History Notes

[MySQL] az mysql flexible-server mirroring: Add enable and disable commands to support Fabric Mirroring


This checklist is used to make sure that common guidelines for a pull request are followed.

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests
⚠️ None ️✔️ 130/130
⚠️AzureCLI-BreakingChangeTest
⚠️mysql
rule cmd_name rule_message suggest_message
⚠️ 1011 - SubgroupAdd mysql flexible-server mirroring sub group mysql flexible-server mirroring added

Copilot AI review requested due to automatic review settings July 23, 2026 07:57
@mohitsinha-ms
mohitsinha-ms requested review from a team as code owners July 23, 2026 07:57
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi @mohitsinha-ms,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@a0x1ab

a0x1ab commented Jul 23, 2026

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mohitsinha-ms mohitsinha-ms changed the title Mohit/fabric mirroring cli fix [MySQL] az mysql flexible-server mirroring enable/disable: Support Fabric Mirroring Jul 23, 2026

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

This PR updates the Azure CLI MySQL module to support Microsoft Fabric Mirroring enable/disable for Azure Database for MySQL Flexible Server, including wiring up new CLI commands and adding a live scenario test. It also bumps the MySQL Flexible Server management SDK dependency to a newer beta required for the mirroring settings model shape.

Changes:

  • Bump azure-mgmt-mysqlflexibleservers from 1.1.0b2 to 1.1.0b3 across setup/requirements.
  • Add az mysql flexible-server mirroring enable|disable commands (params, help, command registration, client factory, custom handlers).
  • Add a new scenario test covering enable/disable flow.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/azure-cli/setup.py Bumps MySQL flexible server management SDK version.
src/azure-cli/requirements.py3.windows.txt Keeps Windows pinned requirements in sync with the SDK bump.
src/azure-cli/requirements.py3.Linux.txt Keeps Linux pinned requirements in sync with the SDK bump.
src/azure-cli/requirements.py3.Darwin.txt Keeps macOS pinned requirements in sync with the SDK bump.
src/azure-cli/azure/cli/command_modules/mysql/tests/latest/test_mysql_scenario.py Adds a live scenario test for mirroring enable/disable.
src/azure-cli/azure/cli/command_modules/mysql/custom.py Implements mirroring enable/disable custom handlers and payload builder.
src/azure-cli/azure/cli/command_modules/mysql/commands.py Registers the new mysql flexible-server mirroring command group.
src/azure-cli/azure/cli/command_modules/mysql/_params.py Adds arguments for the new mirroring commands.
src/azure-cli/azure/cli/command_modules/mysql/_help.py Adds help entries and examples for the new mirroring commands.
src/azure-cli/azure/cli/command_modules/mysql/_client_factory.py Adds a client factory for Fabric mirroring settings operations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/azure-cli/azure/cli/command_modules/mysql/_params.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/mysql/custom.py
Comment thread src/azure-cli/azure/cli/command_modules/mysql/commands.py
@yonzhan

yonzhan commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

MySQL

@yonzhan
yonzhan requested a review from Pan-Qi July 23, 2026 08:06
@Pan-Qi

Pan-Qi commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@a0x1ab

a0x1ab commented Jul 23, 2026

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@mohitsinha-ms

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 33774 in repo Azure/azure-cli

@mohitsinha-ms

Copy link
Copy Markdown
Member Author

@a0x1ab -- can you please run /azp run
cc: @Pan-Qi , @yonzhan

@a0x1ab

a0x1ab commented Jul 23, 2026

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@a0x1ab

a0x1ab commented Jul 23, 2026

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@mohitsinha-ms

Copy link
Copy Markdown
Member Author

@microsoft-github-policy-service agree company="Microsoft"

@mohitsinha-ms

Copy link
Copy Markdown
Member Author

@a0x1ab -- Please help with your code review. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants