Azure / Azure/azure-cli

[Feature Request] Support `--force-refresh` in `az account get-access-token`

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

Description

## Requirement

There are some use cases where the user wants to get a new/fresh access token, bypassing the ADAL/MSAL token cache.

More info at https://github.com/Azure/azure-powershell/issues/14005.

## Proposed solution

Support `--force-refresh` in `az account get-access-token`.

## Additional context

ADAL doesn’t support `force_refresh`:

https://github.com/AzureAD/azure-activedirectory-library-for-python/blob/7dddec09ebeec853986d1f0e66eb5469afb2ccbc/adal/authentication_context.py#L130

```py
def acquire_token(self, resource, user_id, client_id):
```

MSAL supports `force_refresh`:

https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/53b99957201b5bea299c91fe634e830535b2ad8f/msal/application.py#L519

```py
def acquire_token_silent(
self,
scopes, # type: List[str]
account, # type: Optional[Account]
authority=None, # See get_authorization_request_url()
force_refresh=False, # type: Optional[boolean]
claims_challenge=None,
**kwargs):
```

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.