Skip to content

Commit

Permalink
{ACR} Fixed a bug where creating cache rule without credential set wo…
Browse files Browse the repository at this point in the history
…uld fail (#30984)

With latest az cli 2.70 release we unfortunately introduced a
regression. Creating a cache rule without a credential set would crash.
It is caused by a local variable not declared in the correct scope.

A bug issue has been created to track this issue:
Azure/acr#822

This commit fixed the issue. Now creating cache rules work as expected.
  • Loading branch information
renshao authored Mar 10, 2025
1 parent 4b16e32 commit 3c2e1fb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/acr/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def acr_cache_create(cmd,
resource_group_name=None,
cred_set=None):

rg = get_resource_group_name_by_registry_name(cmd.cli_ctx, registry_name, resource_group_name)
if cred_set:
sub_id = get_subscription_id(cmd.cli_ctx)
rg = get_resource_group_name_by_registry_name(cmd.cli_ctx, registry_name, resource_group_name)
# Format the credential set ID using subscription ID, resource group, registry name, and credential set name
cred_set_id = CREDENTIAL_SET_RESOURCE_ID_TEMPLATE.format(
sub_id=sub_id,
Expand Down

0 comments on commit 3c2e1fb

Please sign in to comment.