Automatically prompt to run `az login` in case of authentication failure
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
**Related command**
Any command that requires authentication.
**Is your feature request related to a problem? Please describe.**
Any command that requires authentication may receive authentication failure due to Conditional Access policy, such as
```
$ az aks list
AADSTS700082: The refresh token has expired due to inactivity. The token was issued on 2022-08-10T22:52:01.4927938Z and was inactive for 90.00:00:00.
Trace ID: 1f6fa410-64eb-4312-82c3-ab4173858500
Correlation ID: 4d65b3dc-6320-4268-8e00-a66963a55a81
Timestamp: 2023-01-06 22:52:25Z
Interactive authentication is needed. Please run:
az login --scope https://management.core.windows.net//.default
```
**Describe the solution you'd like**
It feels like it would be a little nicer if we offered to run that for the user (assuming that they have prompts turned on). Something like:
```
Interactive authentication is needed. Please run:
az login --scope https://management.core.windows.net//.default
Would you like to run that now? [Y/n]
```
Contributor guide
Assessment
This issue has not been assessed yet.