Azure / Azure/azure-cli

Refine or deprecate `--refresh` in `az account list`

Open
#20,429 2 comments 2 reactions 1 assignee Claimed by @jiasli View on GitHub
Account act-identity-squad feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Context

`--refresh` in `az account list` was introduced by #4091 on 2017-07-29 and was never maintained ever since then.

It doesn't work with managed identity and Cloud Shell account:

```
$ az login --identity
...
$ az account list --refresh
Refreshing for 'systemAssignedIdentity' failed with an error 'No matched service principal found'. The existing accounts were not modified. You can run 'az login' later to explicitly refresh them
...
```

It adds a lot of complexity given the same effect can be achieved by

```
az account clear
az login
```

The usage of `--refresh` is not very popular. Here is the client telemetry for the last 7 days:

| | invocations | subscriptions |
| - | - | - |
| `az account list --refresh` | 2522 | 280 |
| all commands | 1156167962 | 73166 |

```
RawEventsAzCli
| where EventTimestamp > ago(7d) and EventTimestamp < ago(1h)
| extend exeVersion = tostring(Properties['context.default.vs.core.exeversion'])
| extend clientRequestId = tostring(Properties['context.default.azurecli.clientrequestid'])
| extend result = tostring(Properties['reserved.datamodel.action.result'])
| extend commandName = tostring(Properties['reserved.datamodel.entityname'])
| extend CommandRaw = tostring(Properties['context.default.azurecli.rawcommand'])
| extend paramSet = tostring(Properties['context.default.azurecli.params'])
| extend FaultTypeString = tostring(Properties['reserved.datamodel.fault.typestring'])
| extend FaultMessage = tostring(Properties['reserved.datamodel.fault.exception.message'])
| where RawCommand == 'account list'
| where paramSet contains '--refresh'
| summarize count(), dcount(AzureSubscriptionId)
```

## Proposals

`--refresh` should either be

- Refined to support managed identity and Cloud Shell account
- Deprecated and removed

## Also see

- https://github.com/Azure/azure-cli/issues/17607
- https://github.com/Azure/azure-cli/issues/20402

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.