Azure / Azure/azure-cli

Concurrent az login causes 'User does not exist in MSAL token cache' due to token cache corruption (portalocker ValueError: can't have unbuffered text I/O)

Open
#30,046 6 comments 0 reactions 2 assignees Claimed by @isra-fel View on GitHub
Account act-identity-squad ARM Auto-Assign Auto-Resolve Azure CLI Team customer-reported question
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### 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. Run `az 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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.