azure-cli
azure-cli copied to clipboard
az login does not work in GitHub Codespaces
Describe the bug
az login with default options doesn't work with GitHub Codespaces. It fails when trying to hit localhost on response.
To Reproduce
Open GitHub Codespaces. run az upgrade to get to 2.30 run az login in GitHub Codespaces, the default codespace is fine.
This is printed:
The default web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.
**Workaround **
- Use
--use-device-code
option - Detect if user is in Codespaces by checking
CODESPACES=true
env var and callaz login
with--use-device-code
Expected behavior
It should work in GitHub Codespaces with default options.
Environment summary
GitHub Codespaces Linux-5.4.0-1062-azure-x86_64-with-debian-bullseye-sid, Ubuntu 20.04.3 LTS Python 3.6.10 Installer: DEB
azure-cli 2.30.0
Additional context