[SQL] az sql mi link: Add multi-database link support - #33874
[SQL] az sql mi link: Add multi-database link support#33874Ivan (ivankostic85) wants to merge 5 commits into
az sql mi link: Add multi-database link support#33874Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR updates the az sql mi link command set to use API version 2025-08-01-preview and introduces multi-database link capabilities (create via --link-mode, update membership via --databases), along with scenario coverage and refreshed recordings.
Changes:
- Bump
sql mi linkAAZ command implementations to2025-08-01-previewand surfacelinkModein outputs. - Add
--link-modetoaz sql mi link createand add--databasessupport toaz sql mi link updatefor multi-database links. - Add/refresh scenario tests + recordings for multi-database link management and error handling.
Reviewed changes
Copilot reviewed 10 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py | Adds multi-database MI link scenario tests and updates existing MI link checks to validate linkMode. |
| src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_mi_multi_database_link_mgmt.yaml | New recording covering multi-database link create/show/list/delete flows. |
| src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_mi_multi_database_link_error_handling.yaml | New recording covering multi-database validation/error cases (invalid link mode usage, name rules, update requirements). |
| src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/link/_create.py | Updates API version and adds --link-mode; returns linkMode from create. |
| src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/link/_update.py | Updates API version; adds --databases and returns linkMode from update. |
| src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/link/_show.py | Updates API version and returns linkMode from show. |
| src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/link/_list.py | Updates API version and returns linkMode from list. |
| src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/link/_failover.py | Updates API version and returns linkMode from failover. |
| src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/link/_delete.py | Updates API version for delete. |
Suppressed comments (2)
src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py:8800
.get_output_in_jsonis referenced but never called, so this line evaluates to a bound method object. Call it (or remove it) for consistency with the other scenario assertions.
self.cmd('sql mi link list -g {rg} --instance-name {mi_name}',
checks=[JMESPathCheck('length(@)', 0)]).get_output_in_json
src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py:8897
.get_output_in_jsonis referenced but never called, so this line evaluates to a bound method object. Call it (or remove it) for consistency with the other scenario assertions.
self.cmd('sql mi link list -g {rg} --instance-name {mi_name}',
checks=[JMESPathCheck('length(@)', 0)]).get_output_in_json
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
az sql mi link: Add multi-database link support
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
SQL |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3ed3549e-3089-4b9a-91ca-ed7fff5a8e6d
e9fbd80 to
8a6aff1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 15 changed files in this pull request and generated no new comments.
Suppressed comments (3)
src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py:8629
- _wait_for_databases will busy-loop in playback mode (in_recording == False) and can still run for the full timeout even though recordings will never change. Consider returning immediately in playback (let the subsequent checks fail) and always sleeping between polls in recording mode.
if last_count == expected_count:
return result
if self.in_recording:
time.sleep(interval)
src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py:8171
- These tests hard-code a resource group/MI name that appears tied to an individual (e.g., "ivankostic-rg", "ivan-mi-25") along with a private endpoint IP. In a public repo, this is better kept generic to avoid leaking personally identifying/environment-specific details and to keep recordings reusable. Consider switching to non-personal, scenario-specific names and re-recording the tests.
rg = 'ivankostic-rg'
mi_name = 'ivan-mi-25'
box_name = 'wwi-2022-sql02'
link_name = 'Link1'
instance_ag_name = 'AG_CLI1_MI'
partner_ag_name = 'AG_CLI1'
replication_mode = 'Async'
database_name = 'CLI1'
databases = "[{database-name:CLI1}]"
partner_endpoint = 'tcp://172.16.1.130:5022'
src/azure-cli/azure/cli/command_modules/sql/aaz/latest/sql/mi/link/_update.py:89
- Minor grammar: "The name of the database in link" is missing an article, which shows up in CLI help output. Consider updating to a clearer phrase.
_element.database_name = AAZStrArg(
options=["database-name"],
help="The name of the database in link",
)
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
🤖 PR Validation —⚠️ Review suggested
Related command
az sql mi link createaz sql mi link updateaz sql mi link showaz sql mi link listaz sql mi link failoveraz sql mi link deleteDescription
This PR adds multi-database Managed Instance link support using API version
2025-08-01-preview.Changes include:
az sql mi linkcommands to API version2025-08-01-preview.--link-modetoaz sql mi link create, supportingSingleDatabaseandMultiDatabase.--databasestoaz sql mi link updatefor updating database membership on multi-database links.linkModefrom create, update, show, list, and failover commands.Testing Guide
Run the recorded Managed Instance link tests:
azdev test test_sql_mi_link test_sql_mi_multi_database_link --seriesThe following validation checks were also run successfully:
azdev style --repo . --src HEAD --tgt <merge-base>azdev linter --ci-exclusions --min-severity medium --repo . --src HEAD --tgt <merge-base>azdev latest-index verify --repo .History Notes
[SQL]
az sql mi link create: Add multi-database link mode support[SQL]
az sql mi link update: Add database membership updates for multi-database linksThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.