Azure / Azure/azure-cli

Add `--use-auth-code` flag to force auth code without browser

Open
#21,934 3 comments 3 reactions 2 assignees Claimed by @rayluo View on GitHub
Account act-identity-squad customer-reported Feature Candidate feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

In `az login`, add `--use-auth-code` flag to trigger auth code authentication flow even on computers without detected browsers. Today, the only way to trigger it is to have a [browser installed](https://github.com/Azure/azure-cli/blob/d331edf76e5866cda1e6e9641d935256fc4f03ff/src/azure-cli-core/azure/cli/core/_profile.py#L155) but this suggested flag would just print out URL instead of opening a tab in browser if a browser does not exist.

**Is your feature request related to a problem? Please describe.**

We use our local conditional access enabled browser to login to Azure when using vscode remote containers. This function would enable enterprises using conditional access in Azure to use Azure CLI in their development containers.

**Describe the solution you'd like**

Just like forcing device code we'd like to use auth code challenge even on machines without browser installed. The expected behavior is that the challenge URL will be printed (if no browser installed). This would enable us to manually use that URL to login through another browser (that complies with conditional access policies) by completing the challenge and then sending a request to the callback URL ourselves in the machine that provided us the URL.

**Alternatives considered**

We can still get this working by installing e.g. terminal-based browser on the Linux to get the URL as workaround but it's more painful and not an enterprise-wide scalable experience.

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.