Skip to content

[ACR] az acr create/update and az acr check-health: Add ABAC support for ACR registry#31065

Merged
zhoxing-ms merged 16 commits intoAzure:devfrom
lizMSFT:zoeyli/acr/abac_registry
Apr 27, 2025
Merged

[ACR] az acr create/update and az acr check-health: Add ABAC support for ACR registry#31065
zhoxing-ms merged 16 commits intoAzure:devfrom
lizMSFT:zoeyli/acr/abac_registry

Conversation

@lizMSFT
Copy link
Member

@lizMSFT lizMSFT commented Mar 18, 2025

Related command
az acr create
az acr update
az acr check-health

Description
These commands introduce new functionality for the ABAC feature.

History Notes
[ACR] az acr create/update: Add a new optional parameter --role-assignment-mode to specify the role assignment mode for new or existing registries. This parameter allows customers to enable or disable Attribute-Based Access Control (ABAC)
[ACR] az acr check-health: Add a new optional parameter --repository to check read, write, and delete permissions for a specific repository

Testing Guide
az acr check-health:

  • ABAC-enabled registry:
    image
  • RBAC-enabled registry:
    image

az acr create | update

PS C:\Users\zoeyli\ACR\azure-cli> az acr create -g zoeytaskclirg -n zoeyclitestacr1 --sku Standard --location southeastasia --zone-redundancy enabled --role-assignment-mode rbac-abac
Warning: You have successfully updated the registry authentication mode to enable RBAC Registry + ABAC Repository Permissions. ACR Tasks within the registry that do not have an assigned identity for source registry access will not have data plane access to the registry. To configure source registry data plane access for your existing Tasks, you must explicitly assign an Entra identity for accessing the source registry using the '--source-registry-auth-id' flag in 'az acr task update'. Please refer to https://aka.ms/acr/auth/abac for more details.    
{
  "roleAssignmentMode": "AbacRepositoryPermissions",
...
}
PS C:\Users\zoeyli\ACR\azure-cli> az acr update -g zoeytaskclirg -n zoeyclitestacr1 --role-assignment-mode rbac                            
{
  "roleAssignmentMode": "LegacyRegistryPermissions",
...
}
PS C:\Users\zoeyli\ACR\azure-cli> az acr update -g zoeytaskclirg -n zoeyclitestacr1 --role-assignment-mode rbac-abac
Warning: You have successfully updated the registry authentication mode to enable RBAC Registry + ABAC Repository Permissions. ACR Tasks within the registry that do not have an assigned identity for source registry access will not have data plane access to the registry. To configure source registry data plane access for your existing Tasks, you must explicitly assign an Entra identity for accessing the source registry using the '--source-registry-auth-id' flag in 'az acr task update'. Please refer to https://aka.ms/acr/auth/abac for more details.    
{
  "roleAssignmentMode": "AbacRepositoryPermissions",
...
}

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

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

azure-client-tools-bot-prd bot commented Mar 18, 2025

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.9
️✔️acs
️✔️latest
️✔️3.12
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.9
️✔️ams
️✔️latest
️✔️3.12
️✔️3.9
️✔️apim
️✔️latest
️✔️3.12
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️aro
️✔️latest
️✔️3.12
️✔️3.9
️✔️backup
️✔️latest
️✔️3.12
️✔️3.9
️✔️batch
️✔️latest
️✔️3.12
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.9
️✔️billing
️✔️latest
️✔️3.12
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.9
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.9
️✔️config
️✔️latest
️✔️3.12
️✔️3.9
️✔️configure
️✔️latest
️✔️3.12
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.9
️✔️container
️✔️latest
️✔️3.12
️✔️3.9
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.9
️✔️core
️✔️latest
️✔️3.12
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.9
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.9
️✔️dls
️✔️latest
️✔️3.12
️✔️3.9
️✔️dms
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.9
️✔️find
️✔️latest
️✔️3.12
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.9
️✔️identity
️✔️latest
️✔️3.12
️✔️3.9
️✔️iot
️✔️latest
️✔️3.12
️✔️3.9
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.9
️✔️lab
️✔️latest
️✔️3.12
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️maps
️✔️latest
️✔️3.12
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.9
️✔️network
️✔️latest
️✔️3.12
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.9
️✔️profile
️✔️latest
️✔️3.12
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.9
️✔️redis
️✔️latest
️✔️3.12
️✔️3.9
️✔️relay
️✔️latest
️✔️3.12
️✔️3.9
️✔️resource
️✔️latest
️✔️3.12
️✔️3.9
️✔️role
️✔️latest
️✔️3.12
️✔️3.9
️✔️search
️✔️latest
️✔️3.12
️✔️3.9
️✔️security
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.9
️✔️sql
️✔️latest
️✔️3.12
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.9
️✔️storage
️✔️latest
️✔️3.12
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.9
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.9
️✔️util
️✔️latest
️✔️3.12
️✔️3.9
️✔️vm
️✔️latest
️✔️3.12
️✔️3.9

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

Hi @lizMSFT,
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

azure-client-tools-bot-prd bot commented Mar 18, 2025

⚠️AzureCLI-BreakingChangeTest
⚠️acr
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd acr check-health cmd acr check-health added parameter repository
⚠️ 1006 - ParaAdd acr create cmd acr create added parameter role_assignment_mode
⚠️ 1006 - ParaAdd acr update cmd acr update added parameter role_assignment_mode

@yonzhan
Copy link
Collaborator

yonzhan commented Mar 18, 2025

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

@github-actions
Copy link

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>

@lizMSFT lizMSFT changed the title [ACR] az acr create | update and az acr check-health: Add ABAC support [ACR] az acr create | update and az acr check-health: Add ABAC support for ACR registry Mar 18, 2025
})

self.cmd('acr create -g {rg} -n {name} --sku Basic --location southeastasia --role-assignment-mode rbac-abac', checks=[
self.check('roleAssignmentMode', 'AbacRepositoryPermissions')
Copy link
Member

Choose a reason for hiding this comment

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

We'd better refer to RoleAssignmentMode instead of using string literals.

@lizMSFT lizMSFT marked this pull request as ready for review April 22, 2025 15:48
@m5i-work
Copy link
Member

@yonzhan @zhoxing-ms This PR looks good to ACR team. Could you take a look when you have time?

wangzelin007
wangzelin007 previously approved these changes Apr 25, 2025
@wangzelin007
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@wangzelin007
Copy link
Member

@zhoxing-ms
Will this PR be able to make it into the May 2025 (2025-05-06) release?

@wangzelin007
Copy link
Member

Hi @lizMSFT
The API version upgrade has caused test failures in other modules. Please rerun the affected tests and upload the latest recording files.

@zhoxing-ms
Copy link
Contributor

Will this PR be able to make it into the May 2025 (2025-05-06) release?

Due to the code completion date of this sprint was 04/21/2025 07:00 UTC, and the release package for this sprint has already been built, so I have to say sorry that this PR cannot catch up with this sprint.
Fortunately, the time between the two releases is very close, and we can release it on May 19th

image

@zhoxing-ms zhoxing-ms changed the title [ACR] az acr create | update and az acr check-health: Add ABAC support for ACR registry [ACR] az acr create/update and az acr check-health: Add ABAC support for ACR registry Apr 25, 2025
@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 31065 in repo Azure/azure-cli

@lizMSFT
Copy link
Member Author

lizMSFT commented Apr 25, 2025

Hello @wangzelin007 @zhoxing-ms We have fixed test failures, could you help re-run the tests, thanks.

@yonzhan
Copy link
Collaborator

yonzhan commented Apr 26, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@lizMSFT
Copy link
Member Author

lizMSFT commented Apr 26, 2025

I've updated the history notes to address the pull request error.

@yonzhan Could you help re-run the tests, thanks.

@yonzhan
Copy link
Collaborator

yonzhan commented Apr 26, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

self.cmd('acr delete -g {rg} -n {name} --yes')

@ResourceGroupPreparer(name_prefix='cli_test_acrabac_')
@live_only()
Copy link
Contributor

Choose a reason for hiding this comment

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

May I ask why do you need to mark this test as live_only()?

Copy link
Member

Choose a reason for hiding this comment

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

This test invokes some local tools (helm etc.) apart from sending ARM requests. So they cannot be executed in recording tests.

@zhoxing-ms zhoxing-ms merged commit 1a26e0d into Azure:dev Apr 27, 2025
48 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Container Registry az acr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants