-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Az cli does not refresh msgraph token cache #25442
Copy link
Copy link
Open
Labels
Accountaz login/accountaz login/accountAuto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamGraph(doesn't work with label-triggered comments; use Graph.Microsoft instead) az ad(doesn't work with label-triggered comments; use Graph.Microsoft instead) az adact-identity-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.feature-request
Milestone
Metadata
Metadata
Assignees
Labels
Accountaz login/accountaz login/accountAuto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamGraph(doesn't work with label-triggered comments; use Graph.Microsoft instead) az ad(doesn't work with label-triggered comments; use Graph.Microsoft instead) az adact-identity-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.feature-request
Describe the bug
After having consented the service principal for the msgraph app permission "Group.Read.All", the token cache is still providing a token without this permission. This results in a 403.
Even after:
The 403 still happens.
I need to execute
az account clearto delete the token cache, or what works better, remove the filemsal_token_cache.binfrom disk. This does not require a new login, but enforces the cli to retrieve a fresh access token.Command Name
az ad group showErrors:
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
Group.Read.Allaz ad group show --group mygroupYields a 403
Expected Behavior
The cli should flush the tokens whenever an
az logouthappens.Environment Summary
Additional Context
az cache listreturns an empty list interestingly--force-refreshinaz account get-access-token#17578az account get-account-token --resource=https://graph.microsoft.comyielded a correct JWT with the consented permissions inside. Interestingly this does not flush the token cache. I guess this could be integrated.