Skip to content

az account get-access-token: Use epoch expiresOn/expires_on #19700

@jiasli

Description

@jiasli

Context

Currently, the expiresOn property in the output of az account get-access-token is a string representing the local time:

{
  "accessToken": "eyJ0eXAiOiJ...",
  "expiresOn": "2021-09-27 16:16:30.921462",  <<<
  "subscription": "0b1f6471-1bf0-4dda-aec3-cb9272f09590",
  "tenant": "54826b22-38d6-4fb2-bad9-b7b93a3e9c5a",
  "tokenType": "Bearer"
}

This inherits from the ADAL behavior: https://github.com/AzureAD/azure-activedirectory-library-for-python/blob/35f9e003bed47936a1df3c6eb696691dc1fa91c3/adal/oauth2_client.py#L187

This causes various time computation problems and difficulties, especially for daylight saving time, such as

Other tools or services are already using an integer to represent the epoch time:

This approach is universal and eliminates all necessary complexity.

Proposal

There are possible approaches:

  1. Make a BREAKING CHANGE to convert the expiresOn in the output of az account get-access-token to an integer representing the epoch time. This can be done during MSAL migration: ADAL to MSAL migration #18944
  2. Introduce another property expires_on. This will not be a BREAKING CHANGE, but introduces naming inconsistency as other properties uses camelCase, but expires_on is snake_case.
  3. Introduce another properties like expiresOnEpoch, but naming like this is non-conventional.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions