AWS Machine Learning Blog 2024年07月30日
Connect Amazon Q Business to Microsoft SharePoint Online using least privilege access controls
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

本文介绍了如何使用 Amazon Q Business 和 SharePoint Online 构建知识库,并使用 Amazon Q Business 连接器连接 SharePoint Online 数据。文章重点介绍了使用最小权限访问控制和 Microsoft SharePoint Dev Support 团队推荐的最佳实践,并使用 AWS Secrets Manager 来确保安全凭据。

👨‍💻 **配置 Amazon Q Business 连接器**:文章详细介绍了如何配置 Amazon Q Business 连接器以连接到 SharePoint Online 网站,并使用 Sites.Selected 权限范围,确保连接器仅访问用户有权访问的数据。

🔐 **使用 AWS Secrets Manager 安全管理凭据**:文章解释了如何利用 AWS Secrets Manager 安全存储连接到 SharePoint Online 的凭据,包括用户名、密码、客户端 ID 和客户端密钥,从而确保安全访问。

🔄 **同步数据和测试解决方案**:文章详细说明了如何将 SharePoint Online 数据同步到 Amazon Q Business,并提供测试解决方案的步骤,包括添加用户和组、分配订阅以及测试用户和组对知识库的访问权限。

🚀 **使用最小权限访问控制**:文章强调了使用最小权限访问控制的重要性,确保用户只能访问他们有权访问的数据,并解释了如何使用 Amazon Q Business 连接器和 AWS Secrets Manager 来实现这一点。

🤝 **最佳实践**:文章介绍了 Microsoft SharePoint Dev Support 团队推荐的最佳实践,包括使用 Sites.Selected 权限范围和 AWS Secrets Manager 来确保安全性和合规性。

Amazon Q Business is the generative artificial intelligence (AI) assistant that empowers employees with your company’s knowledge and data. Microsoft SharePoint Online is used by many organizations as a secure place to store, organize, share, and access their internal data. With generative AI, employees can get answers to their questions, summarize content, or generate insights from data stored in SharePoint Online. Using Amazon Q Business Connectors, you can connect SharePoint Online data to an Amazon Q Business application and start gaining insights from your data quickly.

This post demonstrates how to use Amazon Q Business with SharePoint Online as the data source to provide answers, generate summaries, and present insights using least privilege access controls and best practices recommended by Microsoft SharePoint Dev Support Team.

Solution overview

In this post, we walk you through the process of setting up an Amazon Q Business application that connects to your SharePoint Online sites using an out-of-the-box Amazon Q Business Connector and configuring it using the Sites.Selected application permission scope. The Sites.Selected permission is important because many organizations implement policies that prevent granting read access on all sites (Sites.Read.All) or full control (Sites.FullControl.All) to any connector.

The solution approach respects users’ existing identities, roles, and permissions by enabling identity crawling and access control lists (ACLs) on the Amazon Q Business connector for SharePoint Online using secure credentials facilitated through AWS Secrets Manager. If a user doesn’t have permissions to access certain data without Amazon Q Business, then they can’t access it using Amazon Q Business either. Only the data the user has access to is used to support the user query.

Prerequisites

The following are the prerequisites necessary to deploy the solution:

Register a new app in the Microsoft Azure portal

Complete the following steps to register a new app in the Microsoft Azure portal:

    Log in to the Azure Portal with your Microsoft account. Choose New registration.
      For Name, provide the name for your application. For this post, we use the name TargetApp. The Amazon Q Business application uses TargetApp to connect to the SharePoint Online site to crawl and index the data. For Who can use this application or access this API, choose Accounts in this organizational directory only (<Tenant name> only – Single tenant). Choose Register.
    Note down the application (client) ID and the directory (tenant) ID on the Overview You’ll need them later when asked for TargetApp-ClientId and TenantId. Choose API permissions under Manage in the navigation pane. Choose Add a permission to allow the application to read data in your organization’s directory about the signed-in user.
      Choose Microsoft Graph. Choose Delegated permissions. Choose User.Read.All from the User section. Choose GroupMember.Read.All from the GroupMember section. Choose Sites.Selected from the Sites section. Choose Add permissions.
    On the options menu (three dots), choose Remove permission. Remove the original User.Read – Delegated permission. Choose Grant admin consent for Default Directory.

    Choose Certificates & secrets in the navigation pane. Choose New client secret.
      For Description, enter a description. Choose a value for Expires. Note that in production, you’ll need to manually rotate your secret before it expires. Choose Add. Note down the value for your new secret. You’ll need it later when asked for your client secret (TargetApp-ClientSecret).
    Optionally, choose Owners to add any additional owners for the application. Owners will be able to manage permissions of the Azure AD application (TargetApp).

Use the Graph API to grant permissions to the application on the SharePoint Online site

In this step, you define which of your SharePoint Online sites will be granted access to TargetApp. Amazon Q Business App uses TargetApp to connect to the SharePoint Online site to crawl and index the data.

For this post, we use Postman, a platform for using APIs, to grant permissions. To grant permissions to a specific SharePoint Online site, you need to have another Azure AD application, which we refer to as AdminApp, with Sites.FullControl.All permissions.

If you don’t have the prerequisite AdminApp, follow the previous steps to register AdminApp and for Application Permissions, grant Sites.FullControl.All permissions. As mentioned in the prerequisites, AdminApp will be used only to grant SharePoint Online sites access permissions to TargetApp.

We use the ClientId and ClientSecret values of AdminApp from the Azure AD application to get an AccessToken value.

    Create a POST request in Postman with the URL https://login.microsoftonline.com/{TenantId}/oauth2/v2.0/token. In the body of the request, choose x-www-form-urlencoded and set the following key-value pairs:
      Set client_id to AdminApp-ClientId. Set client_secret to AdminApp-ClientSecret. Set grant_type to client_credentials. Set scope to https://graph.microsoft.com/.default.

    Choose Send. From the returned response, copy the value of access_token. You need it in a later step when asked for the bearer token. Use the value of access_token from the previous step to grant permissions to TargetApp.
      Get the SiteId of the SharePoint Online site by visiting your site URL (for example, https://<yourcompany>.sharepoint.com/sites/{SiteName}) in a browser. You need to log in to the site by providing valid credentials to access the site. Edit the URL in the browser address bar to append /_api/site/id at the end of {SiteName} to get the SiteId. You need this SiteId in the next step.

    Create another POST request in Postman using the URL https://graph.microsoft.com/v1.0/sites/{SiteId}/permissions. Replace {SiteId} in the URL of the request with the SiteId from the previous step.

You can repeat this step for each site you want to include in the Amazon Q Business SharePoint Online connector.

    Choose Bearer Token for Type on the Authorization Enter the value of access_token from earlier for Token.

    For the payload, select raw and enter the following JSON code (replace the <<TargetApp-ClientId>> and <<TargeApp-Name>> values):
{    "roles": [        "fullcontrol"    ],    "grantedToIdentities": [        {            "application": {                "id": "<<TargetApp-clientId>>",                "displayName": "<<TargeApp-Name>>"            }        }    ]}

    Choose Send to complete the process of granting SharePoint Online sites access to the TargetApp Azure AD application.

Configure the Amazon Q Business SharePoint Online connector

Complete the following steps to configure the Amazon Q Business application’s SharePoint Online connector:

    On the Amazon Q Business console, choose Add Data source. Search for and choose SharePoint. Give it a name and description (optional). Choose SharePoint Online for Hosting method under Source settings. Provide the full URL for the SharePoint site that you want to include in crawling and indexing for Site URLs specific to your SharePoint repository.
      If the full URL of the site is https://<yourcompany>.sharepoint.com/sites/anycompany, use <yourcompany> as the value for Domain.
    Choose OAuth 2.0 authentication for Authentication method. Provide the value of TenantId for TenantId.

The SharePoint connector needs credentials to connect to the SharePoint Online site using the Microsoft Graph API. To facilitate this, create a new Secrets Manager secret. These credentials will not be used in any access logs for the SharePoint Online site.

    Choose Create and add a new secret. Enter a name for the secret. Enter the user name and password of a SiteCollection administrator on the sites included in the Amazon Q repository. Enter your client ID and client secret that you got from registering TargetApp in the previous steps. Choose Save.

    Choose Create a new service role to create an IAM role, and enter a name for the role. For Sync scope, choose Select entities and choose All (or specify the combination of items to sync). Choose a sync option based on your needs (on demand or at a frequency of your choice). For this post, we choose on-demand. Choose Add data source. After the data source is created, choose Sync now to start the crawling and indexing.

Test the solution

To test the solution, you can add users and groups, assign subscriptions, and test user and group access within your Amazon Q business application.

Clean up

If you’re only experimenting using the steps in this post, delete your application from the Azure Portal and delete the Amazon Q application from the Amazon Q console to avoid incurring costs.

Conclusion

In this post, we discussed how to configure the Amazon Q Business SharePoint Online connector using least privilege access controls that work with site-level least privileges to crawl and index SharePoint Online site content securely. We also demonstrated how to retain and apply ACLs while responding to user conversations.

Organizations can now use their existing SharePoint Online data to gain better insights, generate summaries, and get answers to natural language queries in a conversational way using Amazon Q Business. By connecting SharePoint Online as a data source, employees can interact with the organization’s knowledge and data stored in SharePoint using natural language, making it effortless to find relevant information, extract key points, and derive valuable insights. This can significantly improve productivity, decision-making, and knowledge sharing within the organization.

Try out the solution in this post, and leave your feedback and questions in the comments section.


About the Authors

Surendar Gajavelli is a Sr. Solutions Architect based out of Nashville, TN. He is a passionate technology enthusiast who enjoys working with customers and helping them build innovative solutions.

Abhi Patlolla is a Sr. Solutions Architect based out of the NYC region, helping customers in their cloud transformation, AI/ML, and data initiatives. He is a strategic and technical leader, advising executives and engineers on cloud strategies to foster innovation and positive impact.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

Amazon Q Business SharePoint Online 知识库 最小权限访问控制 AWS Secrets Manager
相关文章