Skip to content

[ACR] az acr login: Add refreshToken and username fields to the output after using --expose-token parameter#31091

Merged
zhoxing-ms merged 17 commits intoAzure:devfrom
wangxiaoxuan273:add-refresh-token-field
May 19, 2025
Merged

[ACR] az acr login: Add refreshToken and username fields to the output after using --expose-token parameter#31091
zhoxing-ms merged 17 commits intoAzure:devfrom
wangxiaoxuan273:add-refresh-token-field

Conversation

@wangxiaoxuan273
Copy link
Member

@wangxiaoxuan273 wangxiaoxuan273 commented Mar 20, 2025

Related command

Description

changes the output of az acr login --expose-token.

Fixes #20689

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


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

Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Mar 20, 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 @wangxiaoxuan273,
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 20, 2025

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@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>

@yonzhan
Copy link
Collaborator

yonzhan commented Mar 20, 2025

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

@wangxiaoxuan273 wangxiaoxuan273 changed the title fix: add refreshToken field to the output of az acr login --expose-token [ACR] BREAKING CHANGE: add refreshToken and username fields to the output of az acr login --expose-token Mar 20, 2025
@wangxiaoxuan273 wangxiaoxuan273 marked this pull request as ready for review March 20, 2025 08:16
Copy link
Contributor

@Wwwsylvia Wwwsylvia left a comment

Choose a reason for hiding this comment

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

This is not a breaking change, is it?🤔

@johnsonshi
Copy link

johnsonshi commented Mar 20, 2025

@Wwwsylvia and @wangxiaoxuan273 Can we add tests here in this test file to validate that refreshToken is one of the outputted JSON fields?

Right now, the refresh token tests only validate that the method was called with certain arguments. Please validate that the output also contains both the existing and new fields we added.

# Test get refresh token
get_login_credentials(cmd, registry_name, tenant_suffix=tenant_suffix)
self._validate_refresh_token_request(mock_requests_get, mock_requests_post, login_server)

def _validate_refresh_token_request(self, mock_requests_get, mock_requests_post, login_server):
mock_requests_get.assert_called_with('https://{}/v2/'.format(login_server), verify=mock.ANY)
mock_requests_post.assert_called_with(
'https://{}/oauth2/exchange'.format(login_server),
urlencode({
'grant_type': 'access_token',
'service': login_server,
'tenant': TEST_TENANT,
'access_token': TEST_AAD_ACCESS_TOKEN
}),
headers={'Content-Type': 'application/x-www-form-urlencoded'},
verify=mock.ANY)

@wangxiaoxuan273
Copy link
Member Author

This is not a breaking change, is it?🤔

You are right, we are not changing the accessToken field, so this is not a breaking change.

@wangxiaoxuan273 wangxiaoxuan273 changed the title [ACR] BREAKING CHANGE: add refreshToken and username fields to the output of az acr login --expose-token [ACR] add refreshToken and username fields to the output of az acr login --expose-token Mar 21, 2025
Xiaoxuan Wang added 2 commits March 24, 2025 16:49
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
Copy link

@johnsonshi johnsonshi left a comment

Choose a reason for hiding this comment

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

Thank you for adding the tests. I am approving the PR now - however, I have one small request for you to change in the diagnostics.

Xiaoxuan Wang added 3 commits March 27, 2025 12:40
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
@wangxiaoxuan273
Copy link
Member Author

@jsntcy @yanzhudd @zhoxing-ms Can you review and merge this PR? Thanks

Copy link
Contributor

@Wwwsylvia Wwwsylvia left a comment

Choose a reason for hiding this comment

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

LGTM

@yonzhan
Copy link
Collaborator

yonzhan commented Apr 8, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
@wangxiaoxuan273
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

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

Xiaoxuan Wang added 2 commits April 8, 2025 15:46
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
@zhoxing-ms
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@yanzhudd
Copy link
Contributor

please note that Azure CLI will have a code freeze on 04/21/2025 07:00 UTC for the upcoming release. Please address the comments ASAP, otherwise it has to be postponed to next sprint (05-19).

@zhoxing-ms
Copy link
Contributor

Could you please resolve these CI issues and conflicts?

Xiaoxuan Wang added 7 commits May 14, 2025 10:55
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
Signed-off-by: Xiaoxuan Wang <xiaoxuanwang@microsoft.com>
@zhoxing-ms
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Contributor

@Wwwsylvia Wwwsylvia left a comment

Choose a reason for hiding this comment

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

LGTM

@zhoxing-ms zhoxing-ms merged commit 0cf42e2 into Azure:dev May 19, 2025
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.

[ACR] The token returned by az acr login --expose-token is a refresh token instead of an access token

6 participants