Skip to content

[SQL] az sql mi link: Add multi-database link support - #33874

Open
Ivan (ivankostic85) wants to merge 4 commits into
Azure:devfrom
ivankostic85:sql-mi-link-multi-database-support
Open

[SQL] az sql mi link: Add multi-database link support#33874
Ivan (ivankostic85) wants to merge 4 commits into
Azure:devfrom
ivankostic85:sql-mi-link-multi-database-support

Conversation

@ivankostic85

@ivankostic85 Ivan (ivankostic85) commented Aug 11, 2026

Copy link
Copy Markdown

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests
⚠️ None ️✔️ 130/130
⚠️AzureCLI-BreakingChangeTest
⚠️sql
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd sql mi link create cmd sql mi link create added parameter link_mode
⚠️ 1006 - ParaAdd sql mi link update cmd sql mi link update added parameter databases

Related command

  • az sql mi link create
  • az sql mi link update
  • az sql mi link show
  • az sql mi link list
  • az sql mi link failover
  • az sql mi link delete

Description

This PR adds multi-database Managed Instance link support using API version 2025-08-01-preview.

Changes include:

  • Update all az sql mi link commands to API version 2025-08-01-preview.
  • Add --link-mode to az sql mi link create, supporting SingleDatabase and MultiDatabase.
  • Add --databases to az sql mi link update for updating database membership on multi-database links.
  • Return linkMode from create, update, show, list, and failover commands.
  • Add recorded scenarios covering:
    • Multi-database link creation and management.
    • Adding and removing databases.
    • Multi-database validation and error handling.
  • Refresh the existing Managed Instance link recordings for the new API version.

Testing Guide

Run the recorded Managed Instance link tests:

azdev test test_sql_mi_link test_sql_mi_multi_database_link --series

The 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 links


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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3ed3549e-3089-4b9a-91ca-ed7fff5a8e6d
@ivankostic85
Ivan (ivankostic85) requested a review from a team as a code owner August 11, 2026 14:19
Copilot AI lite review requested due to automatic review settings August 11, 2026 14:19
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

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 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 link AAZ command implementations to 2025-08-01-preview and surface linkMode in outputs.
  • Add --link-mode to az sql mi link create and add --databases support to az sql mi link update for 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_json is 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_json is 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.

Comment on lines +8691 to +8694
link_id = link['id']
self.kwargs.update({
'link_id': link_id + '/distributedAvailabilityGroups/' + link_name
})
Comment on lines +8717 to +8718
self.cmd('sql mi link list -g {rg} --instance-name {mi_name}',
checks=[JMESPathCheck('length(@)', 0)]).get_output_in_json
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@ivankostic85 Ivan (ivankostic85) changed the title [SQL] az sql mi link: Add multi-database link support [SQL] az sql mi link: Add multi-database link support Aug 11, 2026
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@yonzhan

Copy link
Copy Markdown
Collaborator

SQL

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.

5 participants