logo

NJP

SSO integration between ServiceNow and Azure Active Directory to use Integration Hub Azure Active Directory spoke

Import · Mar 21, 2019 · article

image

STEP 19: And create scope as shown below and then "Submit" your form:

image

STEP 20: After submitting, click "OAuth Entity Profiles" and select default_profile.

image

STEP 21: If not already automatically added after you submit the record, manually add the two Entry Scopes which you just added:

image

STEP 22: Now it is time to create our credentials. Search for "credentials" and go to "IntegrationHub -> Connections & Credentials -> Credentials". Under "Credentials" page click "New" to create a new credentials:

image

STEP 23: Select "OAuth 2.0 Credentials"

image

STEP 24: And fill the form with appropriate details: a) Name: Name of the credentials b) OAuth Entry Profile: Select the Application Registry default profile which you have created in above step. c) Client Secret: Copied from above

Click "Submit":

image

STEP 25: Click "Get OAuth token" to generate and get your token:

image

STEP 26: A pop-up window will open. Give consent and "Accept":

image

STEP 27: And your token is ready to use:

image

STEP 28: A quick detour! Remember, our goal is being able to use Azure AD Spoke. So let's take a look at it to understand how it is going to use the token we just created. For this we need to "Flow Designer". Search for "integration" and go to "IntegrationHub -> Action Designer":

image

STEP 29: Once we're there, click "Actions" and search for actions under "Microsoft Azure AD Spoke" application:

image

STEP 30: Let's pick one to see how it authenticate itself; "Look Up User ID" for example:

image

STEP 31: In the action, we're looking for a "REST Step" where we make our rest API call. In this particular action, it is "Lookup User". Under "Connection Details" of this step we can see that the step uses a "Connection Alias" called "sn_azure_ad_spoke.AzureAD":

image

STEP 32: Now let's see where we can find that connection alias and how is it connected to our token. In the application navigator, search for "Connections & Credentials" and then go to "Connections & Credentials -> Connections & Credentials Aliases". Here we can see sn_azure_ad_spoke.AzureAD as the ID of the "AzureAD" connection alias. Now we need open it to add our connection with the right token:

image

STEP 33: In the "Connections" tab click on the "New" button:

image

STEP 34: And fill the form with appropriate details: a) Name: Name of the connection b) Select the credential you've created

c) Connection URL: https://graph.microsoft.com

Click on "Update"

image

STEP 35: At this point if we try to run our flow, we get the error below:

image

STEP 36: We still have a couple steps to take. We don’t have LDAP integration so we need to create a test user manually but without a password; a user we already have in Azure AD, in this case our main user:

image

STEP 37: We also need to create a new application in Azure AD for SSO integration. For that, we need to go back to our Azure AD and then "Enterprise applications -> All applications -> New application":

image

STEP 38: Give a name and "Add":

image

STEP 39: Under the application go to "Single sign-on" and select "SAML":

image

STEP 40: Copy/download the details below for further use and click "Test" to test SSO integration:

image

image

STEP 41: It looks like we also need to add our user to the application we just create:

image

STEP 42: To do that, we need to go to "Users and groups" under our application and "Add user":

image

STEP 43: If we go back and test SSO again, now it should work:

image

We should click the "Activate" button to activate SSO between Azure AD and our ServiceNow instance as stated in the "SSO Test Connection Summary" message.

STEP 44: Let's go back to flow designer and run our test flow again. We still have permission relate issues:

image

STEP 45 : To fix that, we need to go back to the app registration we created at the beginning and grant permissions:

image

STEP 46: Under the app registration go to "Settings -> Required permissions -> Microsoft Graph":

image

STEP 47: And "Grant permissions":

image

STEP 48: Since we changed permissions, we also need to refresh our OAuth token with the new permissions:

image

STEP 49: If we run our flow again, now it works and Look Up User ID action returns the user ID that It found in Azure AD:

image

In a separate article, I'll also explain how we can create an example demo flow in flow designer with which we can onboard and offboard users on Azure AD using Integration Hub Azure AD Spoke.

View original source

https://www.servicenow.com/community/in-other-news/sso-integration-between-servicenow-and-azure-active-directory-to/ba-p/2273534