Unable to run powershell script to enable sso to azure portal with google credentials

rohit.reddy 0 Reputation points
2023-05-26T05:57:13.0733333+00:00


enter image description hereHi Team,

I am testing enabling sso to azure portal using google credentials

I am following these documents to set it up

https://support.google.com/a/answer/6363817#zippy=%2Cstep-get-google-identity-provider-idp-information%2Cstep-set-up-office-as-a-saml-service-provider-sp

https://learn.microsoft.com/en-us/education/windows/configure-aad-google-trust

While executing the powershell script which is mentioned in the step(Configure Azure AD as a Service Provider (SP) for Google Workspace)

It is asking me to go to the link and enter the code , but it is saying The code you entered has expired. Get a new code from the device you're trying to sign in to and try again. , even after 30 seconds .

Please team assit me here

Problem start date and time Not sure, use current time

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,575 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,666 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,409 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JamesTran-MSFT 36,656 Reputation points Microsoft Employee
    2023-05-26T19:45:22.93+00:00

    @Anonymous

    Thank you for your detailed post!

    Error Message:

    • Connect-MgGraph: Device code terminal timed-out after 120 seconds. Please try again.User's image

    I understand that you're trying to Configure federation between Google Workspace and Azure AD but when running the PowerShell script located in the Configure Azure AD as a Service Provider section, you're running into the above error message when using Azure Cloud Shell.


    Findings:

    When working through the documentation within my environment, I also ran into this error when using Azure Cloud Shell. However, after reading through both documents that you shared, I noticed that they mentioned using PowerShell / a PowerShell session.

    After installing Azure PowerShell, I was able to install/import the Microsoft.Graph module as referenced in the PS script, and login when prompted to authenticate to Azure AD, using the credentials of my Global Admin account.

    User's image


    Additional Links:

    I hope this helps!

    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.


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.