Skip to content

[Bug] Misleading/Incompolete domain Bug #973

Open

Description

@its-ernest

Misleading/Incompolete domain Bug
A typo returned by the login server while logging into azure using az cli. The CLI instructed me to use use-device-code to avoid getting login failure I was having, and the URL it provided was not not working. I had to guess to get the right domain to use in my browser: login.microsoftonline.com rather worked

To Reproduce
Steps to reproduce the behavior:
log into Azure CLi using:

az login --use-device-code
# Output looked like this:
To sign in, use a web browser to open the page https://login.microsoft.com/device and enter the code ....

Expected behavior
I expected the URL provided by the CLI to work flawlessly and quick, which couldn't happen

What you see instead

The MSAL Python version
python -c "import msal; print(msal.__version__)"

% az version                           
{
  "azure-cli": "2.90.0",
  "azure-cli-core": "2.90.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {}
}

Additional context
After thorough huntinh, I found out that the device code message URL (https://login.microsoft.com/device) is not generated by Azure cli or msal python. It's returned directly by the Microsoft server as the verification_uri field in the device authorization response json. Both Azure CLI and msal just print it as-is (flow["message"])

Image

Activity

  1. basitalisandhu commented on Oct 20, 2026

    @basitalisandhu

    Two things, one of them important:

    The domain in your report is not Microsoft's. login.mircosoftonline.com (the "r" and "c" swapped) is a parked look-alike domain: mircosoftonline.com is registered through Dynadot, uses the above.com parking name servers and resolves to 103.224.182.251, not to Microsoft's sign-in IPs. If that was only a typo while writing the issue, ignore this. If you really opened that address and typed a code, password or MFA answer there, please treat that account as exposed: change the password and revoke its sessions (Revoke-MgUserSignInSession or the "Revoke sessions" button on the user in the Entra admin center).

    The URL the CLI printed is correct. You are right that MSAL does not build it: initiate_device_flow posts to the device authorization endpoint and returns the JSON as is (oauth2cli/oauth2.py#L362-L391), and az prints flow["message"]. I checked it just now: https://login.microsoft.com/device answers 302 to https://login.microsoftonline.com/common/oauth2/deviceauth, the real device code page. login.microsoft.com resolves to different addresses (20.190.x) than login.microsoftonline.com (40.126.x), so a proxy, firewall or DNS filter that only allows login.microsoftonline.com would explain the page not loading for you. Opening https://login.microsoftonline.com/common/oauth2/deviceauth or https://microsoft.com/devicelogin directly gets you to the same page.

    So there is nothing to fix in MSAL for the URL itself.

  2. its-ernest commented on Oct 21, 2026

    @its-ernest
    Author

    2. Two things, one of them important:
    The domain in your report is not Microsoft's. login.mircosoftonline.com (the "r" and "c" swapped) is a parked look-alike domain: mircosoftonline.com is registered through Dynadot, uses the above.com parking name servers and resolves to 103.224.182.251, not to Microsoft's sign-in IPs. If that was only a typo while writing the issue, ignore this. If you really opened that address and typed a code, password or MFA answer there, please treat that account as exposed: change the password and revoke its sessions (Revoke-MgUserSignInSession or the "Revoke sessions" button on the user in the Entra admin center).
    The URL the CLI printed is correct. You are right that MSAL does not build it: initiate_device_flow posts to the device authorization endpoint and returns the JSON as is (oauth2cli/oauth2.py#L362-L391), and az prints flow["message"]. I checked it just now: https://login.microsoft.com/device answers 302 to https://login.microsoftonline.com/common/oauth2/deviceauth, the real device code page. login.microsoft.com resolves to different addresses (20.190.x) than login.microsoftonline.com (40.126.x), so a proxy, firewall or DNS filter that only allows login.microsoftonline.com would explain the page not loading for you. Opening https://login.microsoftonline.com/common/oauth2/deviceauth or https://microsoft.com/devicelogin directly gets you to the same page.
    So there is nothing to fix in MSAL for the URL itself.

    Thanks for point out my spelling mistake, I didn't realize I had written a wrong word for microsoft: mircosoft. Spelling is no typed correctly.
    But the issue is indeed verified to be a true issue with the server response

  3. basitalisandhu commented on Oct 26, 2026

    @basitalisandhu

    Agreed on where it comes from: https://login.microsoft.com/device is the verification_uri the Microsoft identity platform returns from the device authorization endpoint, and MSAL and az only print it. That also means it cannot be fixed in this repository; MSAL has no say in what the server sends.

    What decides whether it works for you is whether your network lets login.microsoft.com through. It is a separate host name from login.microsoftonline.com with different addresses, so a proxy or DNS allow-list that only names login.microsoftonline.com blocks the first and allows the second, which matches what you saw. A quick check from the same machine:

    curl -sI https://login.microsoft.com/device | head -1
    curl -sI https://login.microsoftonline.com/common/oauth2/deviceauth | head -1

    If the first one fails and the second answers, add login.microsoft.com to the allow-list (it is in Microsoft's published endpoint list for Entra ID), or keep using https://microsoft.com/devicelogin. If you would like the CLI to print a fallback address next to the server's one, that request belongs in Azure/azure-cli, since it is the CLI that prints flow["message"].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions