|
| 1 | +--- |
| 2 | + |
| 3 | +title: Add Google as an identity provider for Azure Active Directory B2B | Microsoft Docs |
| 4 | +description: Federate with Google to enable guest users to sign in to your Azure AD apps with their own Gmail account |
| 5 | + |
| 6 | +services: active-directory |
| 7 | +ms.service: active-directory |
| 8 | +ms.component: B2B |
| 9 | +ms.topic: article |
| 10 | +ms.date: 08/20/2018 |
| 11 | + |
| 12 | +ms.author: mimart |
| 13 | +author: msmimart |
| 14 | +manager: mtillman |
| 15 | +ms.reviewer: mal |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +# Add Google as an identity provider for B2B guest users |
| 20 | + |
| 21 | +By setting up federation with Google, you can allow invited users to sign in to your shared apps and resources with their own Google accounts, without having to create Microsoft Accounts (MSAs) or Azure AD accounts. |
| 22 | +> [!NOTE] |
| 23 | +> Your Google guest users must sign in using a link that includes the tenant context, for example `https://myapps.microsoft.com/?tenantid=<tenant id>`. Direct links to applications and resources also work as long as they include the tenant context. Guest users are currently unable to sign in using endpoints that have no tenant context. For example, using `https://myapps.microsoft.com`, `https://portal.azure.com`, or the Teams common endpoint will result in an error. |
| 24 | + |
| 25 | +## What is the experience for the Google user? |
| 26 | +When you send an invitation to a Google Gmail user, the guest user should access your shared apps or resources using a link that includes the tenant context. Their experience varies depending on whether they're already signed in to Google: |
| 27 | + - If the guest user is not signed in to Google, they're prompted to sign in to Google. |
| 28 | + - If the guest user is already signed in to Google, they'll be prompted to choose the account they want to use. They must choose the account you used to invite them. |
| 29 | + |
| 30 | +If the guest user sees a "header too long" error, they can try clearing their cookies, or they can open a private or incognito window and try signing in again. |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +## Step 1: Configure a Google developer project |
| 35 | +First, create a new project in the Google Developers Console to obtain a client ID and a client secret that you can later add to Azure AD. |
| 36 | +1. Go to the Google APIs at https://console.developers.google.com, and sign in with your Google account. We recommend that you use a shared team Google account. |
| 37 | +2. Create a new project: On the Dashboard, select **Create Project**, and then select **Create**. On the New Project page, enter a **Project Name**, and then select **Create**. |
| 38 | + |
| 39 | +  |
| 40 | + |
| 41 | +3. Make sure your new project is selected in the project menu. Then open the menu in the upper left and select **APIs & Services** > **Credentials**. |
| 42 | + |
| 43 | +  |
| 44 | + |
| 45 | +4. Choose the **Oauth consent screen** tab and enter a **Product name shown to users**. (Leave the other settings.) Select **Save**. |
| 46 | + |
| 47 | +  |
| 48 | + |
| 49 | +5. Choose the **Credentials** tab. In the **Create credentials** menu, choose **OAuth client ID**. |
| 50 | + |
| 51 | +  |
| 52 | + |
| 53 | +6. Under **Application type**, choose **Web application**, and then under **Authorized redirect URIs**, enter the following URIs: |
| 54 | + - `https://login.microsoftonline.com` |
| 55 | + - `https://login.microsoftonline.com/te/<directory id>/oauth2/authresp` <br>(where `<directory id>` is your directory ID) |
| 56 | + |
| 57 | + > [!NOTE] |
| 58 | + > To find your directory ID, go to https://portal.azure.com, and under **Azure Active Directory**, choose **Properties** and copy the **Directory ID**. |
| 59 | +
|
| 60 | +  |
| 61 | + |
| 62 | +7. Select **Create**. Copy the client ID and client secret, which you'll use when you add the identity provider in the Azure AD portal. |
| 63 | + |
| 64 | +  |
| 65 | + |
| 66 | +## Step 2: Configure Google federation in Azure AD |
| 67 | +Now you'll set the Google client ID and client secret, either by entering it in the Azure AD portal or by using PowerShell. Be sure to test your Google federation configuration by inviting yourself using a Gmail address and trying to redeem the invitation with your invited Google account. |
| 68 | + |
| 69 | +#### To configure Google federation in the Azure AD portal |
| 70 | +1. Go to the [Azure portal](https://portal.azure.com). In the left pane, select **Azure Active Directory**. |
| 71 | +2. Select **Organizational Relationships**. |
| 72 | +3. Select **Identity providers**, and then click the **Google** button. |
| 73 | +4. Enter a name. Then enter the client ID and client secret you obtained earlier. Select **Save**. |
| 74 | + |
| 75 | +  |
| 76 | + |
| 77 | +#### To configure Google federation by using PowerShell |
| 78 | +1. Install the latest version of the Azure AD PowerShell for Graph module ([AzureADPreview](https://www.powershellgallery.com/packages/AzureADPreview)). |
| 79 | +2. Run the following command: |
| 80 | + `Connect-AzureAD`. |
| 81 | +3. At the sign-in prompt, sign in with the managed Global Administrator account. |
| 82 | +4. Run the following command: |
| 83 | + |
| 84 | + `New-AzureADMSIdentityProvider -Type Google -Name Google -ClientId [Client ID] -ClientSecret [Client secret]` |
| 85 | + |
| 86 | + > [!NOTE] |
| 87 | + > Use the client id and client secret from the app you created in "Step 1: Configure a Google developer project." For more information, see the [New-AzureADMSIdentityProvider](https://docs.microsoft.com/en-us/powershell/module/azuread/new-azureadmsidentityprovider?view=azureadps-2.0-preview) article. |
| 88 | + |
| 89 | +## How do I remove Google federation? |
| 90 | +You can delete your Google federation setup. If you do so, Google guest users who have already redeemed their invitation will not be able to sign in, but you can give them access to your resources again by deleting them from the directory and re-inviting them. |
| 91 | + |
| 92 | +### To delete Google federation in the Azure AD portal: |
| 93 | +1. Go to the [Azure portal](https://portal.azure.com). In the left pane, select **Azure Active Directory**. |
| 94 | +2. Select **Organizational Relationships**. |
| 95 | +3. Select **Identity providers**, and then click the **Google** button. |
| 96 | +4. Select **Google**, and then select **Delete**. |
| 97 | + |
| 98 | +  |
| 99 | + |
| 100 | +1. Select **Yes** to confirm deletion. |
| 101 | + |
| 102 | +### To delete Google federation by using PowerShell: |
| 103 | +1. Install the latest version of the Azure AD PowerShell for Graph module ([AzureADPreview](https://www.powershellgallery.com/packages/AzureADPreview)). |
| 104 | +2. Run `Connect-AzureAD`. |
| 105 | +4. In the login in prompt, sign in with the managed Global Administrator account. |
| 106 | +5. Enter the following command: |
| 107 | + |
| 108 | + `Remove-AzureADMSIdentityProvider -Id Google-OAUTH` |
| 109 | + |
| 110 | + > [!NOTE] |
| 111 | + > For more information about the Remove-AzureADMSIdentityProvider command, read the documentation here. |
0 commit comments