Cannot login to work and school account from Cloud Shell - this page can’t be found: https://login.microsoftonline.com/common/oauth2/undefined

Daniel Turan 51 Reputation points
2023-10-31T09:23:57.75+00:00

I want MgGraph from Azure Cloud Shell (Powershell variant), I have to login to my tenant:

PS /home/user_name> Connect-MgGraph                                                                                  
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXX to authenticate.

However, when I

  1. visit the device login page and enter the code
  2. choose "Use another acount" > "Sign-in Options" -> "Sign in to an organization" and enter my tenant name
  3. I get generic browsers 404 error message:
    This login.microsoftonline.com page can’t be found

No webpage was found for the web address: https://login.microsoftonline.com/common/oauth2/undefined

HTTP ERROR 404

User's image

  1. How to I login to my tenant from Azure Cloud Shell?
  2. Why the cloud shell is not connected already?
Microsoft Security | Microsoft Entra | Microsoft Entra External ID
Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Entra | Other
{count} votes

4 answers

Sort by: Most helpful
  1. Fabio Andrade 1,665 Reputation points Microsoft Employee Moderator
    2023-10-31T20:34:42.1633333+00:00

    Hi @Daniel Turan

    Thanks for reaching out to Microsoft Q&A

    The main reason why you are getting the error message is because you are already signed into Azure Cloud shell with the same account you used to sign into Azure Portal, but since you are trying to use Microsoft Graph, you need to sign into it as it's a different resource than Azure Portal.

    That being said, when using Azure Cloud shell you need to simply use your credentials to it instead of trying to sign into a different organization.

    After adding the code, if your account is not listed for pickup, select Use another account option and insert your credentials in there instead of signing into another organization.

    User's image

    Let me know how that works for you.

    Thanks,

    Fabio


  2. Fabio Andrade 1,665 Reputation points Microsoft Employee Moderator
    2023-11-21T00:09:13.1766667+00:00

    Hi @Daniel Turan

    I wanted to check in and see if you had any other questions or if you were able to resolve this issue?

    If you have any other questions, please let me know. Thank you for your time and patience throughout this issue.


    If the information helped address your question, please Accept the answer. This will help us and also improve searchability for others in the community who might be researching similar information.

    0 comments No comments

  3. Fabio Andrade 1,665 Reputation points Microsoft Employee Moderator
    2023-11-28T17:59:41.88+00:00

    Hi @Daniel Turan

    I wanted to check in and see if you had any other questions or if you were able to resolve this issue?

    If you have any other questions, please let me know. Thank you for your time and patience throughout this issue.


    If the information helped address your question, please Accept the answer. This will help us and also improve searchability for others in the community who might be researching similar information.

    0 comments No comments

  4. Xuemei Jiang 0 Reputation points
    2023-12-07T20:11:18.92+00:00

    Hi,

    it seems I have the similar issue. I am running in a Docker container, and login to my Azure account from terminal:

    user_name:/workdir # az login
    To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code xxxxxxx to authenticate.
    

    Then I

    1. manually open the browser and type in https://microsoft.com/devicelogin
    2. paste the code
    3. click Sign-in options
    4. click Sign in to an organization and enter the domain name of my organization
    5. it shows an 404 error: This login.microsoftonline.com page can’t be found

    Screenshot 2023-12-07 at 21.05.38

    Thanks for the support!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.