G Suite to Office 365 SSO & Provisioning Guide

Table of Contents

1. Topic Overview

Overview of our scenario and expected output .

Jump to section

2. System Requirements

Let us ensure system prerequisite for G Suite to Office SSO.

Jump to section

3. Office 365 ImmutableId

What is immutableId and how does it impact federation?

Jump to section

4. G Suite to Office 365 SSO

Step by step instructions to setup Google to Office 365 SSO.

Jump to section

5. Google to Office Provisioning

Instructions to setup G Suite to Office 365 user provisioning.

Jump to section

6. FAQs

Get answer to FAQs, or ask if you have any question.

Jump to section

G Suite to Office 365 SSO & Provisioning

Topic Overview & Expected Output

  • There might be use cases where you would like to setup G Suite SSO to office 365
    so your Office 365 users can authenticate via their G Suite or Google Cloud Identity accounts.

A couple of use cases that I have seen are-:

  1. Your organization has moved to G Suite, but a few users still have accounts in Office 365.
  2. Your organization has moved to Google Cloud Identity as your Identity provider and now needs to authenticate to target applications including Office 365.

Google Cloud Identity is very flexible and it can be used as “Service Provider”, Identity provider or even both.

In this blog post, I would show you how you can use Google Cloud Identity or G Suite as identity provider and use G Suite SSO to sign in Office 365 via SAML 2.0 (or WS-Fed).

Let’s start with our expected output, we should see following after our setup-:

  • Our users should see the Office 365 application icon in their G Suite or Cloud Identity dashboard and launcher, and when they click on it, they should be logged into Office 365 (via their Google Identity) without being asked for credentials.

  • If our users directly go to Office 365, they should be redirected to their Google Cloud Identity (or G Suite) login page, and then back to Office 365 after success Google login.

     

  • Users should be automatically provisioned (and de-provisioned) in Office 365 when they are provisioned (and de-provisioned) in G Suite or Google Cloud Identity.
 

System Requirements

Lets look at the system requirements which you should complete for seamless federation and user lifecycle management from G Suite to Office 365.

G Suite to Office 365 SSO : System Requirements

Office 365 requirements :

  • Verified Domain (e.g yourdomain.com)
  • Global Administrator role
  • PowerShell (with Microsoft Azure Active Directory Module) installed
  • One Test user (user@yourdomain.com)
Notes :
1.  If you have Azure Active Directory Premium, you might be able to create a custom role from Privileged Identity Management instead of assigning Global Admin role (e.g Hybrid Identity Administrator, Directory Synchronization Accounts).

2. You do not own the default Microsoft  domain (e.g yourdomain.onmicrosoft.com), and hence can not setup federation on it. You would need to add the domain you own (e.g goldyarora.com) for it, you can find Microsoft’s documentation to add domain in Office here.


G Suite (or Google Cloud Identity) requirements :

  • Supported G Suite, Cloud Identity or Drive SKU (details below)
  • G Suite or Google Cloud Identity Super Administrator role
  • One Test user provisioned (e.g user@yourdomain.com)

List of Google subscriptions with SSO & Provisioning availability

Plan SSO Provisioning
G Suite Basic Available Available
G Suite Business Available Available
G Suite Enterprise Available Available
Google Cloud Identity Free Available Not Available
Google Cloud Identity Premium Available Available
Google Drive Enterprise Available Not Available
G Suite Education Available Available
G Suite Education Enterprise Available Available

Undestanding Office 365 ImmutableId

In this section, let’s understand Office 365 immutableId attribute, how does it impact our G Suite to Office 365 SSO, and how to fix it with a few PowerShell commands

Understand & Fix Office 365 ImmutableId

Office 365 has an immutableId attribute to uniquely identify users (primaryKey). It is similar to objectGUID in Active Directory.


Now what your users’ immutableId would look like depends on how you provision your users, lets look at various provisioning options along with their impact on immutableId-:

  1. You have just setup Office 365 and the only user you have is someuser@somename.onmicrosoft.com : You do not need to worry about ImmutableId as you have not created users in Office 365 (except your default .onmicrosoft.com one), you can simply go to next section as you don’t need to fix immutableId).

  2. Users created directly in Office 365 Admin Console on “Non-Federated” domain : ImmutableId would be blank.

  3. Users created via Azure AD Sync : ImmutableId would be the base64 encoded version of Active Directory’s objectGUID (based on default directory sync configuration, but can be changed).

  4. Users created via Identity Provider (e.g Okta) on a federated domain : ImmutableId would be the value you send to Office 365 when making create user API call via your IdP.


 If you are in #2, #3 or #4 category, please read following carefully :

As your Office 365 users have immutableId which is different than their Office 365 UPN

You have two options to deal with it :

Option 1 : Custom Attribute in Google with your ImmutableId

Create a custom attribute in Google (e.g immutableId) → populate it with users’ office 365 immutableId → and then configure Google to send this custom attribute when responding to SAML request.

However, this option would be painful as it requires you to keep managing and populating Google users with their respective Office 365 immutableId.

If you decide to go with this option, you can skip the rest of this section, and go to next one where I show you how to setup G Suite to Office 365 SSO.

Option 2 : Change your users’ ImmutableId

 

Now, by definition, immutableId is not meant to be changed, however there might be scenarios like this where you might consider to change it.

You may keep reading if you decide to go with this option, as I would now show you how to change your Office 365 users’ immutableId.

Change ImmutableId

You would need to disable Directory Sync to be able to change ImmutableId, you can do it with  following PowerShell command :

Set-MsolDirSyncEnabled -EnableDirSync $false

1. Run the following Powershell command to see all your users UPN, ImmutableId, whencreated and last directory sync time.

Command to view users in PowerShell :

Get-MsolUser -All | Select-Object UserprincipalName,ImmutableID,WhenCreated,LastDirSyncTime

Command to download in csv :

$exportUsers = Get-MsolUser -All | Select-Object UserprincipalName,ImmutableID,WhenCreated,LastDirSyncTime | Export-Csv C:\csvfile


2. If your users’ immutableId is not equal to their Office 365 UPN, then run the following Powershell command to temporarily change their UPN to a non federated domain.

PowerShell command to change UPN of a single user (Change orange part to yours) :

Set-MsolUserPrincipalName -UserPrincipalName admin@id.goldyarora.com -NewUserPrincipalName admin@second.ci.goldyarora.com

 

PowerShell Command to change UPN of all users except where UPN starts with admin (Change the orange part to yours):

Get-MsolUser -all | Where { -Not $_.UserPrincipalName.ToLower().StartsWith(“admin“) } | ForEach { Set-MsolUserPrincipalName -ObjectId $_.ObjectId -NewUserPrincipalName ($_.UserPrincipalName.Split(“@”)[0] + “@second.ci.goldyarora.com“) }

3. Run the following PowerShell command to change ImmutableId of your users whom UPN is now temporarily changed to non federated domain.

PowerShell command to change ImmutableId of a single user (Change the orange part to yours) :

Set-MsolUser -UserPrincipalName admin@second.ci.goldyarora.com -ImmutableId admin@id.goldyarora.com

 

PowerShell Command to change ImmutableId of all users except where UPN starts with admin (Change the orange part to yours) :

Get-MsolUser -all | Where { -Not $_.UserPrincipalName.ToLower().StartsWith(“admin“) } | ForEach { Set-MsolUser -ObjectId $_.ObjectId -ImmutableId ($_.UserPrincipalName.Split(“@”)[0] + “@id.goldyarora.com“) }

4. Run the following powerShell command to change the UPN back to original as we have now changed the ImmutableId.

PowerShell command to change UPN of a single user (Change the orange part to yours):
Set-MsolUserPrincipalName -UserPrincipalName admin@second.ci.goldyarora.com -NewUserPrincipalName admin@id.goldyarora.com

 

PowerShell Command to change UPN of all users except where UPN starts with admin (Change the orange part to yours) :
Get-MsolUser -all | Where { -Not $_.UserPrincipalName.ToLower().StartsWith(“admin“) } | ForEach { Set-MsolUserPrincipalName -ObjectId $_.ObjectId -NewUserPrincipalName ($_.UserPrincipalName.Split(“@”)[0] + “@id.goldyarora.com“) }

5. Run the following PowerShell command to confirm that ImmutableId for our users have been changed and now matching the UPN.

Command to view users in PowerShell-:

Get-MsolUser -All | Select-Object UserprincipalName,ImmutableID Command to download in csv-:

$exportUsers = Get-MsolUser -All | Select-Object UserprincipalName, ImmutableID | Export-Csv C:\csvfile

Now you are ready to move to next step where we will setup G Suite to Office 365 Single Single On (SSO).

G Suite to Office 365 SSO Setup

G Suite to Office 365 SSO Guide

Setup Office 365 as Service Provider in G Suite

1. Login to G Suite or Google Cloud Identity Admin Console (admin.google.com)

2. Go to Apps, and then click on SAML apps as shown in the screenshot below 

Go to SAML Apps in Google Admin Console

Click on + icon to search and add Office as SAML application.

Click plus icon to add a new SAML app
  1. Search Google’s SAML apps catalogue for Office 365.

  2. Go to Microsoft Office 365 from the search results.

  3. Click on the right arrow (shown as #3 in screenshot below) to configure Office 365 as SAML application.
 
Add Office 365 SAML app
  1. Download IDP metadata from option two (we will use the values from it when configuring Google as IDP in Office 365 later).

  2. Click on Next after your downloaded metadata.
Download IDP metadata from Google
  • You may leave the default values for Application name and click on next
leave app name as default and click on next

1. Enable Signed Response by checking the box as shown in the screenshot below.

2. Select Basic Information –> Primary Email to be sent in Name ID

3. Select “Persistent” as the Name ID format.

Note : If you did not change your Office 365 users’ immutableId to UPN, and rather decided to go with immutableId itself, then select your custom attribute which contains users’ immutableId here, and not primary email.
configure Office 365 details in Google SAML app
  1. Select Basic Information –> Primary Email for the IDPEmail attribute mapping.

  2. Click on “Finish” to complete SAML application setup for Office 365.
setup attribute mapping for Google to Office 365 SSO

Create Powershell variables for Office 365 SSO

Office 365 needs a few properties for federation setup so it can securely send SAML request to Google, and can also parse the the response.

Property Name Why we need it? Property Value
Domain Name This will our Office 365 domain name that we want to federate to Google. Domain Name that we want to federate.
Authentication We would need to tell Office 365 our authentication method. Federated
Federation Brand Name This is for our reference, we can provide any contextual name here (e.g Google) Google Cloud Identity
Issuer URI Microsoft needs to know who issued the SAML response, here we would put our Google Entity ID here. Entity ID

(Available in the IDP metadata that we downloaded from Google)
Active and passive logon URI This would be the Identity provider (Google in our case) URL, which Office 365 would refer to as SSO URL. Google SSO URL

(available in the IDP metadata file that we downloaded from Google)
LogOffUri To specify where should Office 365 redirect our users when they log out.

You can put URL any URL here.
https://accounts.google.com/logout
Signing Certificate This would be the public key which Google provided us, Office 365 would use this to identity itself in the SAML request, and also to parse SAML response. X509Certificate Value

(available in the IDP metadata file that we downloaded from Google)
PreferredAuthenticationProtocol To specify the preferred authentication protocol. SAMLP

Your variables would look like this (with your own values for domain name, federated brand name, issuerUri, activeLogOnUri, PassiveLogOnUri, Signing Certificate)

$domainName = “id.goldyarora.com”
$Authentication = “Federated”
$FederationBrandName = “Google Cloud Identity”
$IssuerUri = “https://accounts.google.com/o/saml2?idpid=C03a9sjs9
$PassiveLogOnUri = “https://accounts.google.com/o/saml2/idp?idpid=C03a9sjs9
$ActiveLogOnUri = “https://accounts.google.com/o/saml2/idp?idpid=C03a9sjs9
$LogOffUri = “https://accounts.google.com/logout”
$SigningCertificate = “MIIDdDCCAlygAwIBAgIGAXEQDuMqMA0GCSqGSIb3DQEBCwUAMHsxFDASBgNVBAoTC0dvb2dsZSBJbmMuMRYwFAYDVQQHEw1
Nb3VudGFpbiBWaWV3MQ8wDQYDVQQDwZHb29nbGUxGDAWBgNV

BAsTD0dvb2dsZSBGb3IgV29yazELMAkGA1UEBhMCVVMxEzARBgN
VBAgTCkNhbGlmb3JuaWEwHhcNMjAwMzI1MDQ1OTAxWhcNMjUw
MzI0MDQ1OTAxWjB7MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEWMB
QGA1UEBxMNTW91bnRhaW4gVmlldzEPMA0GA1UEAxMGR29vZ2xlM
RgwFgYDVQQLEw9Hb29nbGUgRm9yIFdvcmsxCzAJBgNVBAYTAlVTM
RMwEQYDVQQIEwpDYWxpZm9ybmlhMIIBIjANBgkqhkiG9w0BAQEFAA
OCAQ8AMIIBCgKCAQEA6GfDWaCspEWgMKE8aTpUq3W95p9JulrT4UE
ROj6s3/RJDpyCeZQYOPOcFiJqEIPwiEK5QFkQFHOZUEgjqhHAcyDUf1D

Now let us copy our variables, and run them in Powershell

  • Open Microsoft Powershell
Open Microsoft Powershell
  • Connect to Office 365 with the command Connect-MsolService
Connect to Office 365 in Powershell with connect-msolservice command
  • Now a window would pop up asking for your Office 365 credentials.

  • Enter your Office 365 Administrator Email Id.
enter your office 365 admin email id
  • Enter your Office 365 Administrator Password.
enter your office 365 admin password
  • If you are enrolled in to MFA, verify your identity by authentication via MFA.
do the mfa if you have enabled it
  • Now paste the copied variables that you created above as shown in the screenshot and press enter.

  • If everything went fine here, you won’t see any error, and Powershell would be ready to take next command.
enter your powershell variables
  • Now we need to run command to setup federation (or change it if you already have federation setup) which would ask PowerShell to fetch values of the federation properties from the variables we just defined.

  • You can also run this command to check whether your domain is already federated or not.
  • Get-MSolDomainFederationSettings -DomainName id.goldyarora.com | Format-List *

Run the following PowerShell command IF this is the first time you are setting up federation on this domain:

Set-MsolDomainAuthentication -DomainName $domainName -Authentication $Authentication -FederationBrandName $FederationBrandName -IssuerUri $IssuerUri -ActiveLogOnUri $ActiveLogOnUri -PassiveLogOnUri $PassiveLogOnUri -LogOffUri $LogOffUri -SigningCertificate $SigningCertificate -PreferredAuthenticationProtocol SAMLP

Run the following PowerShell command IF you already have federation on this domain, and now need to change it to Google :

Set-MsolDomainFederationSettings -DomainName $domainName -Authentication $Authentication -FederationBrandName $FederationBrandName -IssuerUri $IssuerUri -ActiveLogOnUri $ActiveLogOnUri -PassiveLogOnUri $PassiveLogOnUri -LogOffUri $LogOffUri -SigningCertificate $SigningCertificate -PreferredAuthenticationProtocol SAMLP

Enter powershell command to setup federation
  • Now let us test to ensure federation settings are set for our domain.

  • Run the following Powershell command replacing id.goldyarora.com with your own domain.

  • Get-MSolDomainFederationSettings -DomainName id.goldyarora.com | Format-List *

  • You should see the values of your variables against the federation properties as shown in the screenshot below.

Provide Office 365 SAML application access to our Google users

Now, as we are done with Google Cloud Identity or G Suite to Office 365 SSO setup, we need to assign Office 365 SAML application to our required users.

You can either assign this application to all of your users in Google tenant, OR only to a subset of users via their OrgUnit or Group membership.

I would recommend you to put one test user in a group (lets called Office365testgroup), and then give Office 365 SAML app access only to this group.

This way we would be able to test our SSO before we roll it out to broader audience.

Once you create your Group and add a test user in it, assign Office 365 app to this group as shown in below screenshot :

(Note -: The test user you add in this group, should already be provisioned in Google)

  1. Go to Office 365 SAML app that you created in Google.
  2. In the left hand navigation, search for your Group.
  3. Enable the App for this group.
  4. Save changes.

Testing our SSO (Google / Identity Provider Initiated)

  • Login to Google with your test user and to https://gsuite.google.com/dashboard

  • Here you should see Office 365 application as it has been assigned to you via test group membership.
Office 365 SAML app in Google dashboard
  • As you are already logged in to your Google account, Google would send the SAML assertion to Office 365 when you click on the application icon.

  • You should have been logged in successfully to your Office 365 application.


    Note-: If your Office 365 Administrator has enabled MFA, and if you haven’t set it up yet, you would be asked to register it.

Logged into Office 365 via Google SSO

Testing our SSO (Office 365 / Service provider Initiated)

Now, as we have federation in place, when our user tries to login directly to Office 365, he should be redirected to Google.

sign in to office 365

Office 365 is redirecting our user to Google as we have setup Google as our identity provider.

Office 365 should redirect to Google for SSO

Now if the user is already logged into Google, then user would straight away land to Office 365 page.

If the user is not already logged into Google, then would require to login to Google first.

Then, if our user would be asked to login to Google (if not already logged in), and should landing at Office 365 after successful login to Google.

login to Google

Now, Google would send the SAML response to Office 365, and user should be logged into Office 365.

Logged into Office 365 via Google SSO

As you have now successfully tested both IdP initiated and SP initiated sign on, feel free to assign Office 365 application to all / required users.

You can turn off SSO if required (may be for troubleshooting) with following command (replace my domain name with yours) :

Set-MsolDomainAuthentication -DomainName id.goldyarora.com -Authentication managed

G Suite to Office 365 Provisioning

In this section, let us understand how we can manage our Office 365 users lifecycle via Google Cloud Identity (or G Suite).

 

Click on the Office 365 application that you created earlier (G Suite Admin Console –> SAML Apps –> Office 365) as shown in the screenshot below.

Go to office 365 SAML app in Google

Click on User Provisioning to start the configuration of G Suite to Office 365 provisioning.

Note : If you do not see User Provisioning here, that means you either do not have Super Admin role in Google, or you have G Suite or Google Cloud Identity plan that does not offer auto user provisioning. 

Click on user provisioning

Click on “Set up user provisioning”.

Set up user provisioning

You would need to authorize Google to be able to create and manage users in Office 365, click on “Authorize”.

authorize G Suite to provision in Office 365

Login in to Office 365 with your Administrator Email

Sign in to Office 365 with admin email

Enter your Office 365 Administrator password

enter your office 365 administrator password

Approve the sign in request if you have MFA enabled on your Office 365 Admin account.

enter your office 365 MFA

Attribute Mapping :

  • You would now need to map attributes (e.g which attributes should Google send to Office 365 to create and manage your users.

  • These 4 attributes shown below are required ones including “onPremisesImmutableId” where you would need to provide mapping.

  • You can any value that you want for immutableId, I would go with G Suite user’s primary email for it.
      
  • You can also click on “Show All” to map other optional attributes.
map google to office 365 attributes

Here you should add your Google group which you would be using for provisioning to Office 365.

Whoever is in this group, would be created as user in Office 365.

Select your Google group as scope to provision in Office 365

Click Ok

Activate Office 365 provisioning in Google

Now as we have mapped the attributes along with defining our provisioning scope via Google group, we are all set to activate provisioning from G Suite to Office 365.

Click on “Activate Provisioning” as shown in the screenshot below.

Activate office 365 provisioning

At this stage, Google would inform us one more time to ensure we have mapped the attributes correctly along with defining our provisioning scope, because once we turn on Activate here, Google would start the provisioning right away.

As we are all set with these requirements, let us go ahead and activate provisioning by clicking on “Activate” button.

Activate provisioning from Google

At this time, users in your scoping group should be created in Office 365.

These actions (including create, suspend or update users) would be logged in your Google Admin Console –> Reporting –> Audit –> Admin.

You should also go to your Office 365 Admin console to confirm that you users are created and/or updated there.

 

FAQs

Here am listing some of the frequently asked questions about G Suite to Office 365 SSO & User Lifecycle management, please comment in the bottom if you have any question, and I will add it (along with the answer) to FAQs.

FAQ

Most frequent questions and answers about G Suite to Office 365 SSO and Provisioning.

Google does not provide an option to provision / manage groups and memberships to Office 365.

Only G Suite or Google Cloud Identity Super Administrators can add SAML applications.

Please make sure you are assigned Super Admin role.

No, Google does not support 3rd party MFA integration.

However you should be able to leverage Google’s MFA (which supports multiple MFA methods including security key).

Google’s MFA is available to G Suite and Google Cloud Identity customers without any additional cost.

Google Cloud Identity (or G Suite) Administrators with Reporting priveleges can look at SAML and Provisioning logs.

Following SAML Login logs are available at this path Admin Console –> Reports –> Audit –> SAML

SAML Login Logs :

  • Event Nama – (e.g Successful login)

  • Event description (e.g Goldy Arora logged in)

  • User (e.g admin@id.goldyarora.com)

  • Application Name (e.g Microsoft Office 365)

  • Organization name (user’s orgUnit name like /Contractors)

  • Initiated by (who initiated the login e.g Service provider or Identity Provider)

  • Failure type (if any failure, e.g Application not configured)

  • Response status (e.g SUCCESS_URI)

  • Response second level status

  • IP Address (login user’s IP address, e.g 96.248.xxx.xx)

  • Date (date and time of user login, e.g 3 Feb 2020, 08:47:59 GMT-5)


Following provisioning (and deprovisioning) logs are available at this path Admin Console –> Reports –> Audit –> Admin

  •  Event Name (e.g Update Auto Provisioned User)

  • Event Description (e.g User admin@id.goldyarora.com was updated on application Microsoft Office 365 by auto provisioning)

  • Admin (which Admin performed this operation)

  • Date (date and time when this operation was performed, e.g 24 Apr 2020, 13:59:30 GMT-4)

  • IP (IP address of the Admin who performed this operation, e.g 96.248.XXX.XX)

 

 

 
 

Ask it in the comments below, and I would try to answer it (if i can) as soon as I get time.

RECOMMENDED READING

As you just read G Suite to Office 365 SSO and Provisioning Guide, I would recommend following as complimentary reading.
G Suite to Office 365 SSO & Provisioning Guide
AdminG SuiteSecuritySSO

G Suite to Office 365 SSO and Provisioning Guide

Read More →
Definitive-Guide-to-Google-Conflicting-Accounts
AdminG Suite

Definitive Guide to Google Conflicting Accounts

Read More →
Password-Vaulted-Apps-Service-in-G Suite-and-Google-Cloud-Identity
AdminG SuiteSecuritySSO

Securely login to any app with G Suite Password Vaulted Apps

Read More →

41 thoughts on “G Suite to Office 365 SSO and Provisioning Guide”

  1. Hi, I got this error after login with GSuite account and click on Office365 APP:

    AADSTS50107: The requested federation realm object ‘https://accounts.google.com/o/saml2?idpid=C02XXXXXX’ does not exist.

    How can I solved it? Thank you

    1. You should look at couple of things-:

      1. Check the immutableId of the user in concern, it should match the user’s primary email address.

      2. Ensure that the certificate has been installed from Google to Office 365 (PowerShell) correctly.

  2. Hi Goldy,

    first let me say thank you very much for this detailed and helpful article, it helped us to complete the task of setting up SSO finally after struggling for a very long time! I highly appreciate your work!

    Unfortunately we are still running into two issues.
    1. When trying to authenticate via Powershell tools (eg Connect-AzAccount) to Azure via a federated GSuite Account, a windows opens in which we enter the user’s email and get forwarded to Google sign-in. After entering the email id (to Google sign-in), a javascript error is coming up (Row 0, Character 0, Error: Script error, Code: 0, URL: https://ssl.gstatic.com/accounts/static/_/js/k=gaia.gaiafe_signin.en_GB.NDip7jdsosI.O/am=DAEAAAAAAAAAAAAIJQ/d=1/ct=zgms/rs=ABkqax2W4vQiXsXmnqnIgR1x4YkH6EPDxA/m=signin,signin_challenge) and asks me whether to proceed with script execution yes/no. Clicking yes or no, i get asked for my password and MFA token, but i’m unable to finalize the authentication properly (MFA does not get approved, probably because of the script error). The window does not change any more, and does not close. Do you know what can be done to resolve this issue? While googling we found a couple of references to a local MS Teams issue (involving clearing local caches), but this has not resolved our problem. We have Chrome installed as the default browser on Win10.

    2. We assigned a Office 365 license to a GSuite SSO user and are able to activate the local installation on a Windows 10 machine successfully. However, after some days, or after a reboot, we are getting a warning saying “There are issues with your account, please login again.” This works, but has to be done every day and is therefore annoying. Do you have any idea on this?

    Again, thanks for all your great how-to’s, it’s greatly appreciated!

    All the best Torben

    1. You’re welcome Torben.
      1. Try installing a SAML tracer chrome plugin and use to trace the saml request and response, this should help figure out, I slightly recall seeing this error but didn’t document what i did to fix it:(.

      2. Sorry, I don’t much idea on this 2nd one.

  3. Hi Seem to have a problem everything works fine in the browser but some users require a full office install licence but when they try and log in all they get is a looks like we cant connect to one of our services right now please try again later HTTP 400 error accounts.google.com

  4. ok, I solved all problem but not provisioning, I got this error in gsuite console:
    Error during Office365 sync: 17007 error code

    1. I have not seen this error, but after googling it a bit, it seems related to granting access to Google to create users in Office 365, try providing the OAuth consent again.

  5. Thank you very much! I got the link to your explanation from Microsoft Support (Adrian) and managed to get it up and running. Our school will be very happy to have automatic access to Office365 and Minecraft Education.
    It’s a shame I cannot automatically assign licenses in O365 (for instance using OU or groups in Gsuite to choose the right license in O365), that would make it fully automated.

  6. hi! If I already have user with @gsuitedomain in offce365 and manage it for a fake SSO creating manually user in Gsuite and Off365 with same username @gsuitedomain but different pwd, what’s happen if I change immutableID of off365 user @gsuitedomain ?

    thanks!

    1. I didn’t understand your question, how would you create the user in Office 365 if you already have it with that email?
      if your question is about creating the user in G Suite with the same email that you have in Office 365, then it’ll not work right away, you would need to change the immutableId in Office 365 to match G Suite user’s email address (unless you want to go with other option that is to put current immutableId in G Suite as a custom attribute and then rather send this custom attribute as nameId in SAML response).

      1. hi! I add gsuite domain in off365 only with TXT DNS record. When I create user in off365 I use @gsuitedomain also in off365 but different pwd, so I have:
        1. gsuite account @gsuitedomain
        2. off365 account @gsuitedomain with different pwd of 1.

        So I have a fake SSO.

        If I want use your real SSO procedure, what’s happen if I change immutableID of off365 user @gsuitedomain ?

        I hope to be more clear.
        ThankS

        1. You have two options here-:
          1. Take the immutable id of off365 user @gsuitedomain –> create a custom attribute in G Suite –> and put immutable id as its value –> send this attribute as SAML nameId value.
          OR
          2. Change the immutableId of off365 user @gsuitedomain to match user’s primary email address, if you do that, nothing will change on the front (e.g you can still login directly to off365 user @gsuitedomain as usual), however it’ll make your SSO setup and management easy.

  7. In the step to test the SSO, I am getting the error
    AADSTS50107: The requested federation realm object ‘https://accounts.google.com/o/saml2?idpid=……… does not exist Please advise

  8. This tutorial is exact what i looking for.
    I administer a Google Suite of a faculty (eg faculty.com), now we are trying to associate Office 365 to our users.

    We are using only the default domain in 365 (faculty.onmicrosoft.com)

    I was following the tutorial and now i am stuck in this part (below)

    * I dont understand the error, the domain name (faculty.com) must be set in office 365? How can i do this?

    *Thank you for sharing your knowledge

    PS C:\Windows\system32> Set-MsolDomainAuthentication -DomainName $domainName -Authentication $Authentication -FederationBrandName $FederationBrandName -IssuerUri $IssuerUri -ActiveLogOnUri $ActiveLogOnUri -PassiveLogOnUri $PassiveLogOnUri -LogOffUri $LogOffUri -SigningCertificate $SigningCertificate -PreferredAuthenticationProtocol SAMLP

    Set-MsolDomainAuthentication : This domain does not exist. Check the name and try again.
    No linha:1 caractere:1
    + Set-MsolDomainAuthentication -DomainName $domainName -Authentication …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (:) [Set-MsolDomainAuthentication], MicrosoftOnlineException
    + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.DomainNotFoundException,Microsoft.Online.Administration.Automation.SetDomainAuthentication

    1. You’re welcome.

      I have this requirement listed in the system requirements section, you do not own/control faculty.onmicrosoft.com, it is Microsoft’s domain, hence you can not setup federation on it.

      You would need to add your domain (e.g faculty.com) in Office 365, you would find Microsoft’s documentation on adding domain under the system requirements section in this post.

    1. Unfortunately, like G Suite, Office 365 does not allow setting up federation within the user interface, so you would have to go with powershell.

      You don’t need any specific server for this thought, any regular windows machine (e.g windows 10, even virtual machine) which can run powershell should be enough.

  9. Dear,
    First of all thank your work and the excellent guide.
    I have a question, that nobody in Microsoft support has been able to answer.
    I am managing GSuite for education and registered the domain in Office365, I am trying to use the GSuite credentials to authenticate in Office365.
    But the step of where you have to use Powershell I cannot do it, because there is no local server, everything is in the cloud.
    I have tried to use Windows 10 PowerShell but it does not recognize the commands.
    I don’t know what I’m doing wrong or how else to integrate SSO into Office365 with GSuite.

    1. Unfortunately, like G Suite, Office 365 does not allow setting up federation within the user interface, so you would have to go with powershell.

      I would recommend you to google some help on how to install powershell and its associated modules to interact with Office 365.

  10. Edömér Csúry

    I just love you man, have been searching for an understandable guide a few days now and you sir helped me with this a lot to complete my contract. Detailed instruction and it worked on the first try! You won a fan today!!! Cheers to you and thank you!!!

  11. Michael Kerry

    Hi,
    I want to disable federation for temporarily (for troubleshooting). I can see powershell command for that.
    But how will I go back to federation, without any issue.

    1. You can turn off SSO by running the command Set-MsolDomainAuthentication -DomainName yourdomainname.com -Authentication managed

      however, if you need to federate after this, you would need to re-do the process (e.g create powershell variables, run the federation command).

  12. Hi Sir,
    G suite identity service will with Microsoft Tenant domain i.e abc.onmicrosoft.com . or we need own domain instead of Microsoft.

  13. I went through the setup steps. When I try to authenticate my test user, it redirects to Google, but when I get to the Microsoft page, I get: “AADSTS5000811: Unable to verify token signature. The signing key identifier does not match any valid registered keys.” I checked the signing certificate with Get-MsolDomainFederationSettings. It seems to match what I have in the metadata file. Any suggestions?

    1. Please ensure there is not space in the cert which you copied from Google, otherwise PowerShell will take it but later you would see an error during user authentication.

  14. You document which Google licensing I need in order to set up SSO, but not the Microsoft license. I’m working with Microsoft 365 Apps for Business. Do you know if I’m still able to set up SSO with this Microsoft licensing level?

  15. If I’m in a non-federated domain, I’m still unclear on what changes I need to make to the O365 user accounts. Do I change the UPN and immutable ID to the corresponding user’s GSuite email address?

    1. 1. I would suggest you to first do a quick look up at your Office 365 users’ immutableId via the provided PowerShell script in this post.

      2. If your immutableId is not equal to your G Suite users’ primary email address, then you should either change it to match G Suite email OR create a custom attribute in G Suite –> populate it with your Office 365 ImmutableId and then use to send this in SAML response.

      1. Your article states that in a non-federated scenario the immutable Id should be blank. If that’s the case, I can set it to the user’s corresponding GSuite address, and I don’t have to do anything to the UPN. Am I understanding correctly?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top