Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

MSAL token (timing?) issue when reading storage account token #30046

Open robbert-nlo opened 1 month ago

robbert-nlo commented 1 month ago

Describe the bug

I originally submitted a bug report with the azurerm terraform provider, but was directed here. Please refer to this issue for the details: https://github.com/hashicorp/terraform-provider-azurerm/issues/27573

Related command

az account get-access-token --scope https://storageaccount.queue.core.windows.net/.default --subscription 12345678-e804-42e5-86ad-98f476ed81b7 -o=json

Errors

ERROR: User 'REDACTED' does not exist in MSAL token cache. Runaz login.

Issue script & Debug output

Please see https://github.com/hashicorp/terraform-provider-azurerm/issues/27573

Expected behavior

All storage account access tokens were correctly read from the token cache.

Environment Summary

azure-cli                         2.64.0 *

core                              2.64.0 *
telemetry                          1.1.0

Extensions:
account                            0.2.5
application-insights              0.1.19
azure-devops                      0.26.0
azure-firewall                    0.14.4
bastion                            0.2.3
costmanagement                     0.2.1
quota                              0.1.0
resource-graph                     2.1.0
ssh                                1.1.3

Dependencies:
msal                              1.30.0
azure-mgmt-resource               23.1.1

Python location '/opt/homebrew/Cellar/azure-cli/2.64.0/libexec/bin/python'
Extensions directory '/Users/user1/.azure/cliextensions'

Python (Darwin) 3.11.10 (main, Sep  7 2024, 01:03:31) [Clang 15.0.0 (clang-1500.3.9.4)]

Additional context

No response

azure-client-tools-bot-prd[bot] commented 1 month ago

Hi @robbert-nlo,

2.64.0 is not the latest Azure CLI(2.65.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

yonzhan commented 1 month ago

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

robbert-nlo commented 1 month ago

Hi @robbert-nlo,

2.64.0 is not the latest Azure CLI(2.65.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

Just tested with 2.65.0, issue is still there.

robbert-nlo commented 1 month ago

Also, I haven't been able to reproduce this on Windows (x86), so this may be MacOS / ARM specific issue.