Azure / Azure/azure-cli

`az login` stuck on connecting to `login.microsoftonline.com:443`

Open
#28,548 30 comments 18 reactions 2 assignees Claimed by @bebound View on GitHub
Account act-identity-squad Auto-Assign Azure CLI Team customer-reported question
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

Running `az login` is stuck after confirmation in the browser. The debug output shows it is waiting to connect to `login.microsoftonline.com:443`.

My machine is connected to the internet. All browsing works fine. I can connect to login.microsoftonline.com in my Safari browser.

### Related command

`az login --scope {} --debug`

### Errors

No error; it is just stuck waiting.

### Issue script & Debug output

```
cli.azure.cli.core.auth.identity: A 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`.
msal.telemetry: Generate or reuse correlation_id: c029d9c5-7926-4ab7-adc6-a0de19d2da3f
msal.oauth2cli.oauth2: Using http://localhost:64330 as redirect_uri
msal.oauth2cli.authcode: Abort by visit http://localhost:64330?error=abort
msal.oauth2cli.authcode: Open a browser on this device to visit: https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize?client_id=04b07795-8ddb-461a-bbee-02f9e1bf7b46&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A64330&scope=https%3A%2F%2Fmanagement.azure.com%2F%2F.default+offline_access+openid+profile&state=NmifcZvXTDBFSpPj&code_challenge=(...)
msal.oauth2cli.authcode: Got auth response: (...)
msal.oauth2cli.authcode: "GET /?code=(...) HTTP/1.1" 200 -
urllib3.connectionpool: Starting new HTTPS connection (1): login.microsoftonline.com:443
^Ccli.knack.cli: Event: Cli.PostExecute []
```

### Expected behavior

`az login` should just work

### Environment Summary

```
macOS-14.3.1-x86_64-i386-64bit, Darwin 23.3.0
Python 3.11.8
Installer: HOMEBREW

azure-cli 2.58.0

Extensions:
azure-devops 1.0.0
ssh 1.1.1

Dependencies:
msal 1.26.0
azure-mgmt-resource 23.1.0b2
```

### Additional context

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.