Enterprises face significant challenges accessing and utilizing the vast amounts of information scattered across organization’s various systems. What if you could simply ask a question and get instant, accurate answers from your company’s entire knowledge base, while accounting for an individual user’s data access levels?
Amazon Q Business is a game changing AI assistant that’s revolutionizing how enterprises interact with their data. With Amazon Q Business, you can access relevant information through natural language conversations, drawing insights from diverse data sources within your organization, adhering to the permissions granted to your user account.
At its core, Amazon Q Business works by first indexing the content from a variety of data sources using built-in data source connectors. These connectors function as an integration layer, unifying content from diverse systems such as Salesforce, Microsoft Exchange, and SharePoint into a centralized index. This consolidated index powers the natural language processing and response generation capabilities of Amazon Q. When a user asks a question using the built-in web experience, Amazon Q Business retrieves relevant content from the index, taking into account user profiles and permissions. It then uses large language models (LLMs) to provide accurate, personalized, and well-written responses based on the consolidated data.
For a full list of Amazon Q supported data source connectors, refer to Supported connectors.
This approach is useful when you need Amazon Q Business to crawl through OneNote or when certificate-based authentication is not preferred or your organization has a strict policy that requires regular password rotation. For a complete list of authentication mechanisms, refer to SharePoint (Online) connector overview.
We provide a step-by-step guide for the Azure AD configuration and demonstrate how to set up the Amazon Q connector to establish this secure integration.
SharePoint is a web-based solution developed by Microsoft that enables organizations to collaborate, manage documents, and share information efficiently. It offers a wide range of features, including using document libraries, viewing lists, publishing pages, sharing events and links, and allowing users to make comments, making it a great tool for team collaboration and content management.
After integrating SharePoint Online with Amazon Q Business, you can ask questions using natural language about the content stored in the SharePoint sites. For example, if your organization’s human resources team manages an internal SharePoint site and maintains a list of holidays for geographical regions, you can ask, “What are the company holidays for this year?” Amazon Q Business will then list region-specific holidays based on your location (country).
The following diagram illustrates the solution architecture. In the upcoming sections, we show you how to implement this architecture. After you integrate Amazon Q Business using the SharePoint connector, Amazon Q Business will crawl through the SharePoint content and update the index whenever content changes. Each published event, page, link, file, comment, OneNote, and attachment on the SharePoint site is treated as a document. In addition to the documents, it also crawls through access control lists (ACLs) for each document (user and group information) and stores them in the . This allows end-users to see chat responses generated only from the documents they have access to.

You can configure Azure AD using either of the following methods:
We demonstrate both methods in the following sections.
To follow along, you need the following prerequisites:
To configure Azure AD using the GUI, complete the steps in this section.
Complete the following steps to register an Azure AD application in the Azure AD tenant that is linked to the SharePoint Online/O365 tenant:



An application will be created. You will see a page like the following screenshot.

Now you can configure the newly registered application with Microsoft Graph and SharePoint API permissions.
When configuring permissions, you have two different options:
For option 1, install the MS Graph PowerShell SDK as a prerequisite.
If you choose option 1, to grant access to specific sites instead of all sites, you need to complete additional prerequisites.
Make sure you have access to another application in Microsoft Entra ID with Sites.FullControl.All application-level permissions, along with its client ID and client secret. This application won’t be used by the Amazon Q Business connector, but it’s needed to grant Sites.Selected permissions only to the application you just registered. If you don’t have access to an application with Sites.FullControl permissions, you can follow the previous steps to register a new application and grant Sites.FullControl as described in option 2. We refer to this application as SitesFullControlApp.
To configure your permissions using option 1, complete the following steps:



Sites.Selected and choose Add permissions.
GroupMember.Read.AllUser.Read.AllYou will see the permissions listed as shown in the following screenshot.

After granting admin consent, your permissions should look like the following screenshot.

https://yourcompany.sharepoint.com/sites/{SiteName}./_api/site/id to the end of {SiteName}. For example, if the original URL was https://yourcompany.sharepoint.com/sites/HumanResources, modify it to https://yourcompany.sharepoint.com/sites/HumanResources/_api/site/id.
| Variable | Description |
AppName |
Display name that you captured earlier. |
AppID |
Application (client) ID that you captured earlier. |
SitesFullControlAppID |
Application (client) ID that was granted with Sites.FullControl.All. This is a prerequisite to have access to another application. This application won’t be used by the Amazon Q Business connector, but it’s needed to grant Sites.Selected permissions only to the application you plan to register. |
SitesFullControlAppClientSecret |
Client secret of the SitesFullControlAppID you entered. |
SiteID |
SharePoint Site ID. |
TenantId |
Directory (tenant) ID that you captured earlier. |
param(
[Parameter(Mandatory = $true,
HelpMessage = "The friendly name of the app registration")]
[String]
$AppName,
[Parameter(Mandatory = $true,
HelpMessage = "Application (client) ID that was registered")]
[String]
$AppID,
[Parameter(Mandatory = $true,
HelpMessage = "Application (client) ID that was granted with Sites.FullControl.All")]
[String]
$SitesFullControlAppID,
[Parameter(Mandatory = $true,
HelpMessage = "Client Secret of the APP ID that was granted with Sites.FullControl.All")]
[string]
$SitesFullControlAppClientSecret,
[Parameter(Mandatory = $true,
HelpMessage = "SharePoint Site ID")]
[String]
$SiteId,
[Parameter(Mandatory = $true,
HelpMessage = "Your Azure Active Directory tenant ID")]
[String]
$TenantId,
[Parameter(Mandatory = $false)]
[Switch]
$StayConnected = $false
)
# You will get access token by logging into application that has Sites.Fullcontrol.All permissions and using the token, grant permissions to new application you created with Sites.Selected permission.
$Scope = "https://graph.microsoft.com/.default"
$TokenEndpoint = "https://login.microsoftonline.com/$TenantId/oauth2/v2.0/token"
# Body of the request
$body = @{
grant_type = "client_credentials"
client_id = $SitesFullControlAppID
client_secret = $SitesFullControlAppClientSecret
scope = $Scope
}
# Get access token
$response = Invoke-RestMethod -Uri $TokenEndpoint -Method POST -Body $body
# URL to grant permission to site
$url = "https://graph.microsoft.com/v1.0/sites/$SiteId/permissions"
# Define the body content as JSON string
$Body = @"
{
"roles": ["fullcontrol"],
"grantedToIdentities": [{
"application": {
"id": "$AppID",
"displayName": "$AppName"
}
}]
}
"@
# Headers
$headers = @{
"Authorization" = "Bearer $($response.access_token)"
"Content-Type" = "application/json"
}
$response = Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $Body
$response
The output from the PowerShell script will look like the following screenshot.

This completes the steps to configure permissions for a specific set of SharePoint site collections.
Complete the following steps to allow full control permissions to all the SharePoint site collections:


FullControl.All and choose Add permissions.
Next, you configure Microsoft Graph application permissions.

GroupMember.Read.AllUser.Read.AllNotes.Read.AllSites.Read.AllNext, you configure SharePoint delegated permissions.

AllSites, select AllSites.Read, and choose Add permission.
You will find the permissions listed as shown in the following screenshot.

After granting admin consent, your permissions will look like the following screenshot.

This completes the steps to configure permissions to allow full control permissions to all the SharePoint site collections.
Complete the following steps to create a client secret:

This value is needed while configuring Amazon Q. Client secret values can’t be viewed except for immediately after creation. Be sure to save the secret.

To deactivate multi-factor authentication (MFA), sign in to the Microsoft Entra Admin Center as security or global administrator and disable the security defaults.

FullControl.All permission, which allows access to all SharePoint sites in your organization.When configuring permissions, consider your organization’s SharePoint access requirements. Many SharePoint admins prefer to grant Amazon Q Business access only to specific sites that need to be crawled, in which case Option 1 with the Sites.Selected permission would be suitable.
For either option, the user running the PowerShell script should be an Azure AD tenant admin or have tenant admin permissions. Additionally, .
Run one of the provided PowerShell scripts, then follow the additional instructions. The scripts will perform the following tasks:
There is one additional prerequisite for option 1 (granting Sites.Selected permission): you need access to another application in Microsoft Entra ID that has the Sites.FullControl.All application-level permission. These are required to grant the Sites.Selected permission to the new application you will register. If you don’t have access to an application with the Sites.FullControl.All permission, you can follow the to register a new application and grant it the Sites.FullControl.All permission. This application will be referred to as SitesFullControlApp.
Use the following script to grant permissions to a specific SharePoint site. You need the following information before running the script.
| Variable | Description |
AppName |
Name of the application that you plan to register. |
SitesFullControlAppID |
Application (client) ID that was granted with Sites.FullControl.All. This is a prerequisite to have access to another application. This application won’t be used by the Amazon Q Business connector, but it’s needed to grant Sites.Selected permissions only to the application you plan to register. |
SitesFullControlAppClientSecret |
Client secret of the app ID you entered. |
SiteID |
SharePoint Site ID. |
TenantId |
Your Azure Active Directory tenant ID. |
param(
[Parameter(Mandatory = $true,
HelpMessage = "The friendly name of the app registration")]
[String]
$AppName,
[Parameter(Mandatory = $true,
HelpMessage = "Application (client) ID that was registered")]
[String]
$AppID,
[Parameter(Mandatory = $true,
HelpMessage = "Application (client) ID that was granted with Sites.FullControl.All")]
[String]
$SitesFullControlAppID,
[Parameter(Mandatory = $true,
HelpMessage = "Client Secret of the APP ID that was granted with Sites.FullControl.All")]
[string]
$SitesFullControlAppClientSecret,
[Parameter(Mandatory = $true,
HelpMessage = "SharePoint Site ID")]
[String]
$SiteId,
[Parameter(Mandatory = $true,
HelpMessage = "Your Azure Active Directory tenant ID")]
[String]
$TenantId,
[Parameter(Mandatory = $false)]
[Switch]
$StayConnected = $false
)
# You will get access token by logging into application that has Sites.Fullcontrol.All permissions and using the token, grant permissions to new application you created with Sites.Selected permission.
$Scope = "https://graph.microsoft.com/.default"
$TokenEndpoint = "https://login.microsoftonline.com/$TenantId/oauth2/v2.0/token"
# Body of the request
$body = @{
grant_type = "client_credentials"
client_id = $SitesFullControlAppID
client_secret = $SitesFullControlAppClientSecret
scope = $Scope
}
# Get access token
$response = Invoke-RestMethod -Uri $TokenEndpoint -Method POST -Body $body
# URL to grant permission to site
$url = "https://graph.microsoft.com/v1.0/sites/$SiteId/permissions"
# Define the body content as JSON string
$Body = @"
{
"roles": ["fullcontrol"],
"grantedToIdentities": [{
"application": {
"id": "$AppID",
"displayName": "$AppName"
}
}]
}
"@
# Headers
$headers = @{
"Authorization" = "Bearer $($response.access_token)"
"Content-Type" = "application/json"
}
$response = Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $Body
$response
The output from the PowerShell script will look like the following screenshot.

Note down the secret value shown in the output and then close the window for security. You will not able to retrieve this value again.
The following script grants full control permissions to all the SharePoint site collections. You need the following information before running the script.
| Variable | Description |
AppName |
The name of the application that you plan to register. |
param(
[Parameter(Mandatory=$true,
HelpMessage="The friendly name of the app registration")]
[String]
$AppName,
[Parameter(Mandatory=$false,
HelpMessage="Your Azure Active Directory tenant ID")]
[String]
$TenantId,
[Parameter(Mandatory=$false)]
[Switch]
$StayConnected = $false
)
# Requires an admin
if ($TenantId)
{
Connect-MgGraph -Scopes "Application.ReadWrite.All User.Read AppRoleAssignment.ReadWrite.All DelegatedPermissionGrant.ReadWrite.All" -TenantId $TenantId
}
else
{
Connect-MgGraph -Scopes "Application.ReadWrite.All User.Read AppRoleAssignment.ReadWrite.All DelegatedPermissionGrant.ReadWrite.All"
}
$SitePermissionAllSitesRead = "4e0d77b0-96ba-4398-af14-3baa780278f4"
$GraphPermissionsGroupMemberReadAll = "98830695-27a2-44f7-8c18-0c3ebc9698f6"
$GraphPermissionsNotesReadAll = "3aeca27b-ee3a-4c2b-8ded-80376e2134a4"
$GraphPermissionsSitesReadAll = "332a536c-c7ef-4017-ab91-336970924f0d"
$GraphPermissionsUserReadAll = "df021288-bdef-4463-88db-98f22de89214"
$GraphPermissionsSitesFullControlAll = "5a54b8b3-347c-476d-8f8e-42d5c7424d29"
# Sharepoint permissions
$sharePointResourceId = "00000003-0000-0ff1-ce00-000000000000"
$SitePermission = @(
@{
Id= $SitePermissionAllSitesRead #AllSites.Read (Delegated) – Read items in all site collections
Type="Scope"
}
)
# Graph permissions
$graphResourceId = "00000003-0000-0000-c000-000000000000"
$graphPermissions = @(
@{
Id = $GraphPermissionsGroupMemberReadAll # GroupMember.Read.All (Application)
Type = "Role"
},
@{
Id = $GraphPermissionsNotesReadAll # Notes.Read.All (Application)
Type = "Role"
},
@{
Id = $GraphPermissionsSitesReadAll # Sites.Read.All (Application)
Type = "Role"
},
@{
Id = $GraphPermissionsUserReadAll # User.Read.All (Application)
Type = "Role"
},
@{
Id = $GraphPermissionsSitesFullControlAll # Sites.FullControl.All (Delegated)
Type = "Scope"
}
)
$requiredResourceAccess = @()
$graphResourceAccess = @{
ResourceAppId=$graphResourceId
ResourceAccess= $graphPermissions
}
$spResourceAccess = @{
ResourceAppId = $sharePointResourceId
ResourceAccess = $SitePermission
}
$requiredResourceAccess += $spResourceAccess
$requiredResourceAccess += $graphResourceAccess
# Get context for access to tenant ID
$context = Get-MgContext
# Create app registration
$appRegistration = New-MgApplication -DisplayName $AppName -SignInAudience "AzureADMyOrg" `
-Web @{ RedirectUris="http://localhost"; } `
-RequiredResourceAccess $requiredResourceAccess `
-AdditionalProperties @{}
Write-Host -ForegroundColor Cyan "App registration created with app ID" $appRegistration.AppId
# Add client secret
#$clientSecret = [System.Net.WebUtility]::UrlEncode(([System.Text.Encoding]::UTF8.GetBytes((New-Guid).ToString() + "abcdefghijklmnopqrstuvwxyz0123456789")))
$clientSecretCredential = Add-MgApplicationPassword -ApplicationId $appRegistration.Id -PasswordCredential @{ displayName = "Client Secret"; EndDateTime = (Get-Date).AddYears(2) }
Write-Host -ForegroundColor Cyan "Client secret created "
$secretValue = $clientSecretCredential.SecretText
Write-Host -ForegroundColor Red "Secret Text is [$secretValue]"
Write-Host -ForegroundColor Red "Please Clear the screen after noting down the Secret value."
#$clientSecretCredential | Format-List
# Create corresponding service principal
$servicePrincipal= New-MgServicePrincipal -AppId $appRegistration.AppId -AdditionalProperties @{} | Out-Null
Write-Host -ForegroundColor Cyan "Service principal created"
Write-Host
Write-Host -ForegroundColor Green "Success"
Write-Host
#Admin consent
$scp = Get-MgServicePrincipal -Filter "DisplayName eq '$($AppName)'"
$app = Get-MgServicePrincipal -Filter "AppId eq '$graphResourceId'"
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $scp.id -PrincipalId $scp.Id -ResourceId $app.Id -AppRoleId $GraphPermissionsGroupMemberReadAll
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $scp.id -PrincipalId $scp.Id -ResourceId $app.Id -AppRoleId $GraphPermissionsNotesReadAll
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $scp.id -PrincipalId $scp.Id -ResourceId $app.Id -AppRoleId $GraphPermissionsSitesReadAll
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $scp.id -PrincipalId $scp.Id -ResourceId $app.Id -AppRoleId $GraphPermissionsUserReadAll
New-MgOAuth2PermissionGrant -ClientId $scp.id -consentType "AllPrincipals" -resourceId $app.Id -Scope "Sites.FullControl.All"
if ($StayConnected -eq $false)
{
Disconnect-MgGraph
Write-Host "Disconnected from Microsoft Graph"
}
else
{
Write-Host
Write-Host -ForegroundColor Yellow "The connection to Microsoft Graph is still active. To disconnect, use Disconnect-MgGraph"
}
The output from the PowerShell script will look like the following screenshot.

Note down the secret value shown in the output and then close the window for security. You will not able to retrieve this value again.
Make sure you have set up Amazon Q Business with Entra ID as your identity provider as mentioned in the prerequisites. Also, make sure the email ID is in lowercase letters while creating the user in Entra ID.
Follow the instructions in Connecting Amazon Q Business to SharePoint (Online) using the console.
For Step 9 (Authentication), we choose Oauth 2.0 and configure it as follows:
This is the directory (tenant) ID in your registered Azure application, in the Azure Portal, as shown in the following screenshot (the IDs will be different for your setup).

In this section, we discuss some frequently asked questions.
There are a few possible scenarios for this issue. If no users are getting a response from a specific document, verify that you have synced your data source with Amazon Q. Choose View report in the Sync run history section. For more information, see Introducing document-level sync reports: Enhanced data sync visibility in Amazon Q Business.

If a specific user is unable to access, verify that their email address in SharePoint matches with the email address of the corresponding identity in IAM Identity Center and entered in lowercase in IAM Identity Center. For more information, refer to Known limitations for the SharePoint (Online) connector.
For troubleshooting purposes, you can use the
The connector crawls event attachments only when Events is also chosen as an entity to be crawled. Make sure that you chose the corresponding entities in the sync scope.

In some cases, you might get the error message, “Sharepoint Connector Error code: SPE-5001 Error message: Authentication failed:” when trying to sync.
To address this, validate that the user name, password, clientId, clientSecret, and authType values are correct in the secret that you created for this connector. Verify that MFA is deactivated.
After the content has been updated on SharePoint, you must re-sync the contents for the updated data to be picked up by Amazon Q. Go to the data sources, select the SharePoint data source, and choose Sync now. After the sync is complete, verify that the updated data is reflected by running queries on Amazon Q.
If you experience issues when signing in, clear your browser cookies and sign in as a new user.
Verify that the user or group has subscriptions to Amazon Q Business. Check the corresponding user group and then choose Manage access and subscriptions and select the corresponding subscription.

In some cases, users might get the following message when they upload a file through their user experience: “Your Amazon Q Business subscription doesn’t include file uploads. Please contact your administrator for assistance.”
For troubleshooting guidance, refer to Troubleshooting your SharePoint (Online) connector.
Complete the following steps to clean up your resources:
Amazon Q Business offers much more than just a powerful AI assistant. Explore its other capabilities that allow you to customize the user experience, empower your workforce, and increase productivity:
In this post, we explored how to integrate Amazon Q Business with SharePoint Online using the OAuth 2.0 ROPC flow authentication method. We provided both manual and automated approaches using PowerShell scripts for configuring the required Azure AD settings. Additionally, we demonstrated how to enter those details along with your SharePoint authentication credentials into the Amazon Q console to finalize the secure connection.
The ROPC flow offers an alternative to certificate-based authentication for connecting Amazon Q Business to SharePoint Online. This can be useful when you want Amazon Q Business to crawl through OneNote or if you don’t want to deal with certificates or in scenarios that require regular password rotation.
By following this post, enterprises can take advantage of the powerful knowledge mining capabilities of Amazon Q to unlock insights from their SharePoint data repositories and knowledge bases.
Ramesh Eega is a Global Accounts Solutions Architect based out of Atlanta, GA. He is passionate about helping customers throughout their cloud journey.
Manuel Rioux est fièrement propulsé par WordPress