Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for refreshing the access token of an account #29185

Open
maskati opened this issue Jun 17, 2024 · 4 comments
Open

Add support for refreshing the access token of an account #29185

maskati opened this issue Jun 17, 2024 · 4 comments
Assignees
Labels
Account az login/account ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request
Milestone

Comments

@maskati
Copy link

maskati commented Jun 17, 2024

Related command
az account

Is your feature request related to a problem? Please describe.
Some scenarios require refreshing the cached access token of an account, for example when user's group membership changes as a consequence of PIM for Groups.

Describe the solution you'd like
Provide a mechanism to refresh the cached access token of an account e.g. az account refresh-access-token.

Describe alternatives you've considered
Waiting for token expiration or performing az logout and az login.

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group labels Jun 17, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Jun 17, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Account az login/account labels Jun 17, 2024
@yonzhan yonzhan added this to the Backlog milestone Jun 17, 2024
@yonzhan yonzhan added feature-request and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 17, 2024
@jiasli
Copy link
Member

jiasli commented Jun 17, 2024

Supporting --force-refresh in az account get-access-token is tracked by #17578.

Does az account clear and az login work for you? It may be related to #26573.

@maskati
Copy link
Author

maskati commented Jun 17, 2024

az account clear or az logout do work, but are not ideal since the user is already authenticated and only requires a refreshed access token. It's unfortunate that MSAL does not allow forcing refresh of the token in the cache, mearly skipping the cache altogether for a single token acquisition (--force-refresh). Clearing the cache is not useful since it also clears the refresh token.

Would it be possible to expand --force-refresh to be a global parameter? It would would probably need to be more clearly named since "force refresh" is clear in the context of get-access-token but not in general.

@maskati
Copy link
Author

maskati commented Jun 18, 2024

Actually it seems like force_refresh does update the token cache, so this issue would be resolved by performing az account get-access-token --force-refresh > /dev/null to force cached token update and then performing the desired operation. Looking forward to #17578 being implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Account az login/account ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request
Projects
None yet
Development

No branches or pull requests

4 participants