logo

NJP

Configuring SharePoint Online Search Connector

Import · Sep 26, 2023 · article

The ServiceNow SharePoint Online Search Connector offers a modern consumer-grade search configuration to manage your information resources.

As search is the key to productivity, SharePoint Online Search Connector (SPOC) helps your employees to search and discover content from the ServiceNow employee experience. You can index content from multiple sites, enabling employees to find the relevant information through Employee Center, Service Portal, Now Mobile app, and Virtual Agent.

Here's a step by step Instruction guide organized across two parts for configuring SharePoint Online Search Connector on your instance. The first part will cover configuring Azure configurations and the second part will cover configuring ServiceNow configurations.

Part 1: Azure Configuration

Recording

Video to access the steps - Azure Setup

  1. * Log in to the Azure Portal.
  2. * Navigate to "Azure services" and select "App Registrations."
    • Create a new app registration or select an existing one.
  3. * Once inside the app, note down the "Client ID" (Application ID).
    • Remember that the "Tenant ID" is common for the SharePoint instance.
  4. * In the app settings, go to "Certificates & secrets."
    • Create a new client secret with a description and expiration.
    • Store the generated client secret securely.[Important]
  5. * Move to the "Certificates & secrets" tab.
    • Upload the necessary certificate file (e.g., .cer file or .certificate). Follow the below steps to generate a certificate file (.jks and .cer file pairs)
    • Note the "Thumbprint" of the uploaded certificate.[Store the thumbprint to be added later in the ServiceNow instance]

If you are looking for ways to generate .jks and .cer file, here are some helpful commands to generate .jks and .cer file using java keytool

keytool -genkey -alias -keyalg RSA -keystore .jks -storepass -validity 360 -keysize 2048

keytool -export -alias -file .cer -keystore .jks -storepass

You would need the jks file while later in ServiceNow configurations

  1. * Navigate to "API permissions" within the app settings.
  2. * Click "Add a permission" > "Microsoft Graph."
    • Choose "Delegated permissions"
    • Go to sites and add "Sites.Read.All" permission.
    • Go to the user module and select User.read
  3. * Click "Add permissions" > "SharePoint."
    • Select "Application permissions"
    • Give "Sites.FullControl.All" and "User.Read.All" permissions.[TO BE CHANGED]
  4. * Grant admin consent for the added permissions.
  5. * Move to the "Authentication" tab.
    • In the "Redirect URIs" section, add your ServiceNow instance URL followed by "/oauth_redirect.do" or the appropriate path. Eg- https:///oauth_redirect.do
  6. * Save your changes and ensure all required configurations are completed on the Azure portal side.

Part 2: ServiceNow Configuration

Step 1

Recording

Video to access the steps - ServiceNow Configuration Step 1

Prerequisites

  1. Obtain the Client ID, Client Secret, and Tenant ID from the Azure application created for the connector.
  2. Generate a Java Key Store file and a certificate to be used for authentication.
  3. Know the SharePoint host URL.

Create Connections

  1. Go to "Application Registry" in ServiceNow.
  2. For more details go to "Setting up SharePoint Online" section in product documentation
  3. Create a record for the SharePoint Rest connection:
    • Name: Choose a name (e.g., SharePoint Rest).
    • Client ID: Use the Azure Client ID.
    • Client Secret: Use the Azure Client Secret.
    • Script: Refer to script - OauthUtilSPJWTOnline
    • Grant Type: Client Credential.
    • Token URL: Replace Tenant ID with the tenant id captured from the azure application and add it to the url -- https://login.microsoftonline.com//oauth2/token
    • Redirect URL: Use the SharePoint instance URL followed by oauth_redirect.do
    • Save the record.
  4. Create another record for the SharePoint Graph connection:
    • Name: Choose a name (e.g., SharePoint Graph).
    • Client ID: Use the Azure Client ID.
    • Client Secret: Use the Azure Client Secret.
    • No need for authorization script
    • Grant Type: Authorization Code.
    • Authorization URL: Replace placeholders with Tenant ID. - https://login.microsoftonline.com/ /oauth2/v2.0/authorize
    • Token URL: Replace Tenant ID with the tenant id captured from the azure application and add it to the url -- https://login.microsoftonline.com//oauth2/token
    • Token Revocation URL: Use the SharePoint instance URL followed by oauth_redirect.do
    • Save the record.

Verify OAuth Entity Profile Table

  1. Verify the existence of default profiles for Graph and Rest connections.

OAuth Entity Scopes Table

Create entries for Graph and Rest:

  1. For Graph:
    • Name: Choose a name (e.g., Graph Scope).
    • Provider: Use the Graph application registry record which we created in first step
    • Scope: Use the provided scope in documentation - offline_access https://graph.microsoft.com/Sites.ReadWrite.All
  2. For Rest:
    • Name: Choose a name (e.g., Rest Scope).
    • Provider: Use the Rest application registry record.
    • Scope: Use the ServiceNow instance URL followed by default. eg - https://.sharepoint.com/.default

OAuth Entity Profile Scope Table

Create entries for Graph and Rest:

  1. For Graph:
    • Profile: Choose the default Graph profile as referred to in the Step - Verify OAuth Entity Profile Table
    • Scope: Choose the Graph scope created in the OAuth Entity Scopes configuration
  2. For Rest:
    • Profile: Choose the default rest profile as referred to in the Step - Verify OAuth Entity Profile Table
    • Scope: Choose the Rest scope created in the OAuth Entity Scopes configuration

Step 2

Recording

Video to access the steps - ServiceNow Configuration Step 2

OAuth 2.0 Credentials

  1. Go to "OAuth 2.0 Credentials" in ServiceNow.
  2. Create a record for the Graph connection:
    • Name: Choose a name.
    • Profile: Choose the Graph profile.
  3. Create another record for the Rest connection:
    • Name: Choose a name.
    • Profile: Choose the Rest profile.

Create Connections

  1. Go to the "Connections" table.
  2. Create an HTTPS connection for Graph:
    • Name: Choose a name.
    • Credential: Select the Graph credential.
    • Connection Alias: Use the provided alias - sn_sp_spoke.MicrosoftSharePointGraph
    • Connection URL: Use the provided URL. - https://graph.microsoft.come/v1.0/
  3. Create another HTTPS connection for Rest:
    • Name: Choose a name.
    • Credential: Select the Rest credential.
    • Connection Alias: Use the provided alias. - sn_sp_spoke.MicrosoftSharepointOnline
    • Connection URL: Use the ServiceNow instance host URL. - https:///

Create Tenants

  1. Go to the "Tenants" table.
  2. Create a tenant entry for Graph:
    • Alias: Use the provided alias - sn_sp_spoke.MicrosoftSharePointGraph
    • Tenant ID and Resource Id is auto populated
    • SharePoint Root URL: Use the provided SharePoint root URL.
    • Instance – Choose instance as online

Create Tenants.png

  1. Create another tenant entry for Rest:
    • Alias: Use the provided alias. - sn_sp_spoke.MicrosoftSharePointOnline
    • Tenant ID: Use the Rest tenant ID.
    • SharePoint Root URL: Use the provided SharePoint root URL.

Certificates and JWT Keys

  1. Go to "Certificate" in ServiceNow. Navigate to System Definition -> Certificates -> Microsoft SharePoint Online Certificate
  2. Open the Microsoft SharePoint Online certificate uploaded earlier in section "Upload Certificate" above
  3. Attach the JKS file and enter its password.
  4. Save the record.

Note:

If glide.security.file.mime_type.validation - the value is set to true, then it won't allow the jks file to upload.

Will throw an error File type not permitted or mime type does not match the file content.

Either turn the value to false or add jks file extension in glide.attachment.extensions

JWT Keys

  1. Go to "JWT Keys" and open the JWT key.
  2. Enter the JKS file password and save.

JWT Providers

  1. Go to "JWT Providers" and open the provided JWT provider record available OOB.
  2. Update the "Aud" claim with the url provided in documentation.
  3. Update the "iss" and "sub" claims with the Client ID.

Connection Thumbprint

  1. Open the Rest connection.
  2. Go to "Attributes" and enter the Thumbprint value extracted earlier.
  3. Save the record.

Get Tokens

  1. Go to OAuth2.0 Credentials section and use the "Get Authorization Token" related link for the Rest connection to fetch the Rest token.
  2. Similarly, use the related link for the Graph connection to fetch the Graph token.

Step 3

Recording

Video recording can be found here - ServiceNow Configurations Step 3

EVAM Configuration

User Credential Configuration

  1. Go to the "Connection and Credentials" table.
  2. Open the "SharePoint Ingest User" record (an out-of-box record).
  3. Create a new basic auth credential record:
    • Name: Choose a name (e.g., SharePoint).
    • Username: Specify the SharePoint user's username.
    • Password: Enter the user's password.
    • Ensure the user has the "ais_external_content" role assigned.

Confirm AIS Search Server is configured

  1. Ensure an AIS server is connected and operational.

EVAM Definitions and Bundles

  1. Go to the "EVAM Definitions" table.
  2. Open the "ESC Portal Search" EVAM definition.
  3. Navigate to the "M2M Bundle" tab.
  4. Link an existing bundle, and select "SharePoint Search Bundle."[Available OOB]
  5. Specify an order and submit the record.
  6. Repeat the same process for "Virtual Agent Search," ensuring the proper bundle is linked.

Search Profile Configuration

  1. Go to the "Search Profiles" table.
  2. Open the "ESC Portal Default Search Profile" record.
  3. In the "Search Sources" tab, link the "SharePoint" search Source.
  4. In the same record, ensure the following:
    • Set the state to "Published" for stop words and synonyms.
  5. After making changes, publish the record.

Step 4

Recording

Recording can be found here - ServiceNow Configurations Step 4

  1. * Perform the same steps for the Now Mobile Default Search Profile as you did for the ESC Portal Default Search Profile.
    • Follow the instructions provided earlier to link the SharePoint Search Source and configure any other necessary settings.
  2. * Go to the "Virtual Agent Default Search Engine" table.
    • Open the record and update it with the following values:

Search Application Configurations.png

  1. * In the same record, go to the specified tab.
    • Add a new script for SharePoint integration.

Sharepoint connected script.png

Global Search M2M Item Configuration

Navigate to Global Search M2M Item Configuration (sys_sg_global_search_m2m_master_item) and create the following:

Global Search Configuration: Homepage Search - Catalog, Knowledge, People

Item Configuration: Sharepoint External Search Excel Main Item

Application: SharePoint Search Connector

Global Search Configuration: Homepage Search - Catalog, Knowledge, People

Item Configuration: Sharepoint External Search File Main Item

Application: SharePoint Search Connector

Global Search Configuration: Homepage Search - Catalog, Knowledge, People

Item Configuration: Sharepoint External Search HTML Main Item

Application: SharePoint Search Connector

Global Search Configuration: Homepage Search - Catalog, Knowledge, People

Item Configuration: Sharepoint External Search Pages Main View

Application: SharePoint Search Connector

Global Search Configuration: Homepage Search - Catalog, Knowledge, People

Item Configuration: Sharepoint External Search PDF Main Item

Application: SharePoint Search Connector

Global Search Configuration: Homepage Search - Catalog, Knowledge, People

Item Configuration: Sharepoint External Search PPT Main Item

Application: SharePoint Search Connector

Global Search Configuration: Homepage Search - Catalog, Knowledge, People

Item Configuration: Sharepoint External Search Site Main Item

Application: SharePoint Search Connector

Global Search Configuration: Homepage Search - Catalog, Knowledge, People

Item Configuration: Sharepoint External Search Word Main Item

Application: SharePoint Search Connector

Here is how the search results look like:

MicrosoftTeams-image.png

View original source

https://www.servicenow.com/community/employee-center-articles/configuring-sharepoint-online-search-connector/ta-p/2680212