Skip to content

[Issue] Improve automatic az login detection in EnsureLoggedIn #48

Description

@weikanglim

Output from azd version
Run azd version and copy and paste the output here:
azd version 0.0.1-beta.1699350 (commit 1740868)

Describe the bug
In util.go, EnsureLoggedIn checks for whether a user login is required, then automatically attempts a login. This check currently only looks for "Not logged in" messages, and doesn't account for "Refresh token expired" messages, such as:

root@weilim-z4:~# az account get-access-token --output json
AADSTS70043: The refresh token has expired or is invalid due to sign-in frequency checks by conditional access. The token was issued on 2022-06-29T17:30:46.0555083Z and the maximum allowed lifetime for this request is 43200.
Trace ID: <traceId>
Correlation ID: <correlationId>
Timestamp: 2022-07-11 18:47:42Z
To re-authenticate, please run:
az login --scope https://management.core.windows.net//.default

To Reproduce
Not currently reproducible in the CLI due to another login issue: internal issue #1392

Expected behavior
Automatic login should be triggered when refresh token expires.

Environment
Information on your environment:
* CLI, WSL Ubuntu 22.04

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions