Skip to content

[ACR] az acr connected-registry resync: Add command to manually trigger a sync from the parent registry#33236

Open
nihalvar wants to merge 12 commits intoAzure:devfrom
nihalvar:nihalvar/connected-registry-resync
Open

[ACR] az acr connected-registry resync: Add command to manually trigger a sync from the parent registry#33236
nihalvar wants to merge 12 commits intoAzure:devfrom
nihalvar:nihalvar/connected-registry-resync

Conversation

@nihalvar
Copy link
Copy Markdown

Related command

az acr connected-registry resync

Description

Adds a new command that issues a manual sync request to a connected (on-prem) registry from its parent cloud registry. Wraps the existing ConnectedRegistries.resync SDK operation (API version 2026-01-01-preview).

The call is synchronous and returns the updated ConnectedRegistry resource. The actual data transfer is performed asynchronously by the on-prem agent, lastSyncTime updates only after the agent reports completion. The next sync result will show syncTrigger: ManualResync.

Testing Guide

az acr connected-registry resync \
    --name <myconnectedregistry> \
    --registry <mycloudregistry> \
    --resource-group <rg>

# Subsequent show confirms the trigger:
az acr connected-registry show \
    --name <myconnectedregistry>  \
    --registry <mycloudregistry> \
    --resource-group <rg> \
     
# -> "parent.syncProperties.registrySyncResult.syncTrigger" = "ManualResync"

Recorded test (test_acr_connectedregistry) asserts expect_failure=True because the test registry has no on-prem agent attached, so the service returns ConnectedRegistryHasOfflineChildren. This still validates that the CLI command is correctly registered and accepts the right arguments.

History Notes


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

Copilot AI review requested due to automatic review settings April 21, 2026 07:12
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented Apr 21, 2026

❌AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
❌appservice
❌latest
❌3.12
Type Test Case Error Message Line
Failed test_linux_webapp_quick_create_cd self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f19a04fb350>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f19a0c0b380>
command = 'webapp create -g clitest.rg000001 -n webapp-linux-cd000002 --plan plan-quick-linux-cd -u https://github.com/yugangw-msft/azure-site-test.git&nbsp;-r&nbsp;"NODE
20-lts"'
expect_failure = False

    def in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
>           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/azure-cli-testsdk/azure/cli/testsdk/base.py:303: 
                                        
env/lib/python3.12/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:157: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
                                       _ 

ex = ValidationError("Linux Runtime 'NODE
Failed test_win_webapp_quick_create_cd The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:174
Failed test_win_webapp_quick_create_runtime The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:156
Failed test_download_win_web_log The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:480
Failed test_webapp_config The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:732
Failed test_linux_webapp The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:1261
Failed test_linux_webapp_remote_ssh The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:1366
Failed test_acr_integration The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:1427
Failed test_webapp_linux_acr_use_identity The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:2592
Failed test_webapp_deployment_source_track_runtimestatus_buildfailed The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:3368
Failed test_webapp_deployment_source_track_runtimestatus_runtimefailed The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:3381
Failed test_webapp_track_runtimestatus_buildfailed The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:3307
Failed test_webapp_track_runtimestatus_runtimefailed The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:3320
❌3.13
Type Test Case Error Message Line
Failed test_linux_webapp_quick_create_cd self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fa70e006c10>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fa70eea2990>
command = 'webapp create -g clitest.rg000001 -n webapp-linux-cd000002 --plan plan-quick-linux-cd -u https://github.com/yugangw-msft/azure-site-test.git&nbsp;-r&nbsp;"NODE
20-lts"'
expect_failure = False

    def in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
>           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/azure-cli-testsdk/azure/cli/testsdk/base.py:303: 
                                        
env/lib/python3.13/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:157: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
                                       _ 

ex = ValidationError("Linux Runtime 'NODE
Failed test_win_webapp_quick_create_cd The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:174
Failed test_win_webapp_quick_create_runtime The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:156
Failed test_download_win_web_log The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:480
Failed test_webapp_config The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:732
Failed test_linux_webapp The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:1261
Failed test_linux_webapp_remote_ssh The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:1366
Failed test_acr_integration The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:1427
Failed test_webapp_linux_acr_use_identity The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:2592
Failed test_webapp_deployment_source_track_runtimestatus_buildfailed The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:3368
Failed test_webapp_deployment_source_track_runtimestatus_runtimefailed The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:3381
Failed test_webapp_track_runtimestatus_buildfailed The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:3307
Failed test_webapp_track_runtimestatus_runtimefailed The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_webapp_commands.py:3320
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link
Copy Markdown

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

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented Apr 21, 2026

❌AzureCLI-BreakingChangeTest
⚠️acr
rule cmd_name rule_message suggest_message
⚠️ 1001 - CmdAdd acr connected-registry resync cmd acr connected-registry resync added
❌acs
rule cmd_name rule_message suggest_message
1012 - SubgroupRemove aks approuting gateway sub group aks approuting gateway removed please confirm sub group aks approuting gateway removed
1007 - ParaRemove aks create cmd aks create removed parameter enable_app_routing_istio please add back parameter enable_app_routing_istio for cmd aks create
1007 - ParaRemove aks create cmd aks create removed parameter enable_gateway_api please add back parameter enable_gateway_api for cmd aks create
1007 - ParaRemove aks update cmd aks update removed parameter disable_app_routing_istio please add back parameter disable_app_routing_istio for cmd aks update
1007 - ParaRemove aks update cmd aks update removed parameter disable_gateway_api please add back parameter disable_gateway_api for cmd aks update
1007 - ParaRemove aks update cmd aks update removed parameter enable_app_routing_istio please add back parameter enable_app_routing_istio for cmd aks update
1007 - ParaRemove aks update cmd aks update removed parameter enable_gateway_api please add back parameter enable_gateway_api for cmd aks update

Please submit your Breaking Change Pre-announcement ASAP if you haven't already. Please note:

  • Breaking changes can only be merged during the designated breaking change window
  • A pre-announcement must be released at least one month in advance

For more details on how to introduce breaking changes, refer to the documentation: azure-cli/doc/how_to_introduce_breaking_changes.md

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Apr 21, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new az acr connected-registry resync command to manually trigger a sync from the parent (cloud) registry to a connected (on-prem) registry, wiring it through the existing management-plane SDK operation and updating CLI UX and tests accordingly.

Changes:

  • Register new acr connected-registry resync command and implement handler calling ConnectedRegistries.resync.
  • Add CLI help entry and extend connected-registry table output to surface sync status.
  • Update connected-registry scenario test to invoke resync and assert failure in the no-agent test environment.

Reviewed changes

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

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/acr/connected_registry.py Adds acr_connected_registry_resync implementation calling the SDK resync operation.
src/azure-cli/azure/cli/command_modules/acr/commands.py Registers the new acr connected-registry resync command in the command table.
src/azure-cli/azure/cli/command_modules/acr/_help.py Adds help text and example usage for acr connected-registry resync.
src/azure-cli/azure/cli/command_modules/acr/_format.py Adds “SYNC STATUS” fields to connected-registry show/list table formatting.
src/azure-cli/azure/cli/command_modules/acr/tests/latest/test_acr_connectedregistry_commands.py Extends scenario test to execute resync and expect failure without an on-prem agent.

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

Comment thread src/azure-cli/azure/cli/command_modules/acr/commands.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/acr/_help.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/acr/_format.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/acr/commands.py Outdated
@nihalvar
Copy link
Copy Markdown
Author

@nihalvar please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

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

@nihalvar
Copy link
Copy Markdown
Author

nihalvar commented May 1, 2026

@yanzhudd Can I get eyes on this PR please :)

@nihalvar nihalvar requested a review from joshbaunach May 1, 2026 00:41
@yanzhudd
Copy link
Copy Markdown
Contributor

yanzhudd commented May 1, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@nihalvar nihalvar changed the title [ACR] az acr connected-registry resync: Add command to manually trigger a sync from the parent registry [ACR] az acr connected-registry resync Add command to manually trigger a sync from the parent registry May 1, 2026
nihalvar and others added 6 commits May 4, 2026 10:20
@nihalvar nihalvar force-pushed the nihalvar/connected-registry-resync branch from 64b741e to 3080a50 Compare May 4, 2026 00:27
@yanzhudd
Copy link
Copy Markdown
Contributor

yanzhudd commented May 4, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@yanzhudd yanzhudd changed the title [ACR] az acr connected-registry resync Add command to manually trigger a sync from the parent registry [ACR] az acr connected-registry resync: Add command to manually trigger a sync from the parent registry May 4, 2026
@yanzhudd
Copy link
Copy Markdown
Contributor

yanzhudd commented May 4, 2026

please pull the latest code from the dev branch, and the testing issues should have been fixed

@nihalvar
Copy link
Copy Markdown
Author

nihalvar commented May 4, 2026

please pull the latest code from the dev branch, and the testing issues should have been fixed

pulled, thanks :)

@yanzhudd
Copy link
Copy Markdown
Contributor

yanzhudd commented May 4, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants