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

Rohit manohar 0 Reputation points

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



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

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
14,907 questions
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.
4,907 questions
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
773 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JamesTran-MSFT 29,806 Reputation points Microsoft Employee

    @Rohit manohar

    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.


    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.