Microsoft Teams is an enterprise collaboration tool that allows you to build a unified workspace for real-time collaboration and communication, meetings, and file and application sharing. You can exchange and store valuable organizational knowledge within Microsoft Teams.
Microsoft Teams data is often siloed across different teams, channels, and chats, making it difficult to get a unified view of organizational knowledge. Also, important information gets buried in lengthy chat threads or lost in channel backlogs over time.
You can use Amazon Q Business to solve those challenges. Amazon Q Business is a generative AI-powered assistant that can answer questions, provide summaries, generate content, and securely complete tasks based on data and information in your enterprise systems. It empowers employees to be more creative, data-driven, efficient, prepared, and productive.
Integrating Amazon Q with Microsoft Teams enables you to index all disparate data into a single searchable repository. You can use natural language capabilities to ask questions to surface relevant insights from Microsoft Teams data. With Amazon Q, you don’t have to constantly switch between different Microsoft Teams workspaces and apps to find information. You can query for Microsoft Teams data alongside other enterprise data sources from one interface with proper access controls.
In this post, we show how to connect your Microsoft Teams with Amazon Q using the Amazon Q Business Microsoft Teams connector. We also walk through the connector’s capabilities and common challenges faced when setting it up.
Overview of the Amazon Q Business Microsoft Teams connector
A data source connector is a mechanism for integrating and synchronizing data from multiple repositories into one container index. When you use the data source connector, Amazon Q will have its own index where you can add and sync documents. The document is a unit of data, and how to count a document varies by connector. Amazon Q automatically maps built-in fields to attributes in your data source when it crawls and index documents. If a built-in field doesn’t have a default mapping, or if you want to map additional index fields, custom field mappings can help you specify how a data source attribute maps to your Amazon Q application. For a Microsoft Teams data source, Amazon Q supports the following document types:
- Chat messages – Each chat message is a single document
- Chat attachments – Each chat attachment is a single document
- Channel posts – Each channel post is a single document
- Channel wikis – Each channel wiki is a single document
- Channel attachments – Each channel attachment is a single document
- Meeting chats – Each meeting chat is a single document
- Meeting files – Each meeting file is a single document
- Meeting notes – Each meeting note is a single document
- Calendar meeting (meeting detail) – Each calendar meeting is a single document
Refer to Microsoft Teams data source connector field mappings for which fields are supported for each supported data type. You can also see Supported document formats in Amazon Q Business to understand which documents formats (such as CSV and PDF) are supported for files.
The Amazon Q Business Microsoft Teams connector supports OAuth 2.0 with Client Credentials Flow to authenticate Amazon Q to access your Microsoft Teams instance. Amazon Q requires your Microsoft Teams client ID and client secret to be stored in AWS Secrets Manager.
Amazon Q crawls access control lists (ACLs) and identity information for authorization. Amazon Q indexes the ACL information that’s attached to a document along with the document itself. The information includes the user email address and the group name for the local group or federated group. Then, Amazon Q filters chat responses based on the end-user’s access to documents. Your Amazon Q users can only access to the documents that they have permission to access in Microsoft Teams. An Amazon Q Business connector updates the changes in the ACLs each time your data source content is crawled.
Overview of solution
The following diagram illustrates the solution architecture. In our solution, we configure Microsoft Teams as a data source for an Amazon Q application using the Amazon Q Business Microsoft Teams connector. Amazon Q uses credentials stored in Secrets Manager to access to Microsoft Teams. Amazon Q crawls and indexes the documents and ACL information. The user is authenticated by AWS IAM Identity Center. When user submits a query to the Amazon Q application, Amazon Q retrieves the user and group information and provides answers based on documents that the user has access to.
Prerequisites
Before you set up the Amazon Q Business Microsoft Teams connector, complete the following prerequisite steps in Microsoft Teams.
First, prepare Microsoft users that have the Microsoft Teams license attached. You can achieve this though the Microsoft 365 admin center and referring to Assign licenses by using the Licenses page. If you don’t have Microsoft user account yet, see Add users and assign licenses at the same time.
Next, prepare the Microsoft 365 tenant ID and OAuth 2.0 credentials containing a client ID, client secret, user name, and password, which are required to authenticate Amazon Q to access Microsoft Teams.
- Create a Microsoft Teams account in Microsoft 365. For instructions, refer to How do I get Microsoft Teams?
- Register an application in the Microsoft Azure Portal:
- Log in to the Microsoft Azure Portal with your Microsoft credentials.
- On the App registrations page, choose New Registration to register an application. For instructions, refer to Quickstart: Register an application with the Microsoft identity platform.
- Copy your Microsoft 365 tenant ID and client ID. You can find them on the overview page of your application.
- Create your credentials:
- In the Certificates & secrets section of your application page, choose New Client Secret.
- Complete the Description and Expires fields and choose Add.
- Save the secret ID and secret value to use them later when you configure the Amazon Q Business Microsoft Teams connector.
Make sure you saved the secret value before moving on to other pages. The value is only visible when you create the secret.
- Add necessary permissions:
- In the API Permissions section of your application page, choose Add a Permission.
- Choose Microsoft Graph to add the necessary permissions
- Select your necessary permissions. Refer to Prerequisites for connecting Amazon Q Business to Microsoft Teams for the list of required permissions for Amazon Q to access each document type of Microsoft Teams. Also, review Microsoft Graph permissions reference to understand the scope of each permission.
- Choose Add permissions, and confirm that you successfully added the necessary permissions.
- After you successfully configure the application in the Azure AD portal, you can add some test data in your Microsoft Teams account:
- Log in to Microsoft Teams with your Microsoft Teams user account.
- Add some sample data in the Microsoft Teams chat, calendar, and wiki.
The following screenshot shows an example of information added to the Microsoft Teams chat.
The following screenshot shows an example of information added to the Microsoft Teams calendar.
Create an Amazon Q Business application
An Amazon Q application is the primary resource that you will use to create a chat solution. Complete the following steps to create the application:
- On the Amazon Q Business console, choose Applications in the navigation pane.
- Choose Create application.
- For Application name, enter a name for your application.
- For Access management method, choose AWS IAM Identity Center
- For Quick start user, choose users you will give access to this application:
- If users are not created yet in your IAM Identity Center, choose Add new users and groups, and Add and assign new users.
- Choose Add new users; enter values for Username, First name, Last name, and Email address; and choose Next. This user name must be the same as your Microsoft Teams user name.
- Choose Add, then Assign
- For Select subscription, choose your preferred Amazon Q subscription plan for users. For this post, we choose Q Business Lite. Refer to Amazon Q Business pricing to understand the differences between Q Business Lite and Q Business Pro.
- For Application details, leave it as the default setting.
- Choose Create.
Create and configure a Microsoft Teams data source
Complete the following steps to set up your data source:
- Choose Data sources in the navigation pane on your application page.
- Choose Select retriever:
- For Retrievers, choose Native
- For Index provisioning, choose the model that fits your application needs. For this post, choose Starter.
- For Number of units, enter
1
. Each unit is 20,000 documents or 200 MB, whichever comes first. Refer to the document type table discussed in the solution overview to understand how a document is counted for Microsoft Teams data, and set the appropriate units for the data volume of your Microsoft Teams account. - Choose Confirm
- Choose Add data source on the Data sources page
- Choose Microsoft Teams
- In the Name and description section, enter a name and description for your data source.
- In the Source section, for Tenant ID, enter the tenant ID you saved in the prerequisite steps. Your Microsoft tenant ID is different from your organization name or domain.
- In the Authorization section, for Manage ACLs, choose Enable ACLs.
After you enable ACLs, the data source needs to be deleted and recreated to disable ACLs.
- In the Authentication section, for AWS Secrets Manager secret, choose your Secrets Manager secret that stores your Microsoft Teams client ID and client secret. If you don’t have one, choose Create and add new secret and provide that information.
- For Payment model, choose a licensing and payment model for your Microsoft Teams account.
Some Microsoft Teams APIs in Microsoft Graph can choose a licensing and payment model using the model query
parameter. Refer to Payment models and licensing requirements for Microsoft Teams APIs for more details.
- In the Configure VPC and security group section, choose your resources if you want to use a virtual private cloud (VPC).
- In the IAM role section, create a new service role to access your repository credentials and index content or choose an existing IAM role.
- In the Sync scope section, provide the following information to configure the sync scope for your setup. These settings will significantly affect your crawling and indexing time.
- For Sync contents, select the content to sync.
- Enter a value for Maximum file size.
- Under Additional configuration, provide the following optional information:
- For Calendar crawling, enter the date range for which the connector will crawl your calendar content.
- For User email, enter the user emails you want to include in your application.
- For Team names, add patterns to include or exclude teams found in Microsoft Teams from your application.
- For Channel names, add patterns to include or exclude channels found in Microsoft Teams from your application.
- For Attachment regex patterns, add regular expression patterns to include or exclude certain attachments for all supported entities. You can add up to 100 patterns.
- In the Sync mode section, select how you want to update your index when your data source content changes. We recommend using New, modified, or deleted content sync to only sync new, modified, or deleted content, and shorten the time of the data sync.
- In the Sync run schedule section, choose how often Amazon Q will sync with your data source. For details, see Sync run schedule.
- In the Tags section, you can add tags optionally.
- Choose Add data source
- Navigate to Data source details and choose Sync now to begin crawling and indexing data from your data source.
When the sync job finishes, your data source is ready to use.
Run sample queries
When your data sync is complete, you can run some queries though the Amazon Q web experience.
- On the application details page, navigate to the Web experience settings section and choose the link for Deployed URL.
- Sign in with your IAM Identify Center user name and password (plus multi-factor authentication codes if you configured them). If this is your first time logging in, find the invitation email in your inbox and set up a password by following the instructions in the prompt.
- Enter your queries in the Amazon Q prompt.
The following screenshots show some example queries.
Index aggregated Teams channel posts
With the recent enhancement, Amazon Q Business can now aggregate channel posts as a single document. This allows you to increase accuracy and maximize the use of an index unit.
The following screenshots show a channel post that takes the form of an original post by a user and other users responding, and a sample query for the information on the post. The Teams connector aggregates this post thread as a single document.
Troubleshooting and frequently asked questions
In this section, we discuss some common issues and how to troubleshoot.
Amazon Q Business isn’t answering any questions
The common reason is that your document hasn’t been indexed successfully or your Amazon Q user doesn’t have access to the documents. Review the error message in the Sync run history section in your data source details page. Amazon CloudWatch Logs are also available for you to investigate the document-level errors. For the user permission, make sure you logged in with the correct Amazon Q user. Check if the user name matches the user name in Microsoft Teams. If you still see the issue, open an AWS Support case to further investigate your issue.
The connector is unable to sync or the document isn’t indexed
This could happen due to a few reasons. A synchronization job typically fails when there is a configuration error in the index or the data source. The following are common scenarios:
- Your IAM role attached to your connector doesn’t have enough permission to access the required AWS services (for example, Secrets Manager). We recommend creating a new service role for your connector.
- Your connector doesn’t have the correct credentials to access Microsoft Teams. Review the Microsoft tenant ID, client ID, and client secrets provided to your connector.
- The payment and license model you chose for your connector doesn’t match the required license to call some Microsoft Teams APIs. Review your license and try different ones.
- Your Amazon Q application has reached the maximum limit to ingest documents. Increase the number of units for index provisioning in your Amazon Q application.
- Your Microsoft Graph API calls during your sync might have temporarily faced throttling limits on the number of concurrent calls to a service to prevent overuse of resources. Adjust your sync scope and sync mode of your data source connector to reduce the number of operations per request.
The data source contents are updated, but Amazon Q Business answers using old data
Your Amazon Q index might not have the latest data yet. Make sure you chose the right sync schedule. If you need to immediately sync the data, choose Sync now.
How to determine if the reason you can’t see answers is due to ACLs
Run the same query from two different users who have different ACL permissions in Microsoft Teams.
How to sync documents without ACLs
For the Microsoft Teams connector, you have the option to disable ACLs when you create a data source. When ACLs are disabled for a data source, all documents ingested by the data source become accessible to all end-users of the Amazon Q Business application. To turn off ACLs, you need to be granted the DisableAclOnDataSource
IAM action. If this is disabled during creation, you can enable it at a later time. After you enable ACLs, it can’t be disabled. To disable ACLs, you need to delete and recreate the data source. Refer to Set up required permissions for more detail.
Clean up
To avoid incurring future charges, clean up any resources created as part of this solution.
- Delete the Amazon Q Business Microsoft Teams connector so any data indexed from the source is removed from the Amazon Q application.
- Remove users and unsubscribe the Amazon Q subscription if you created them for your testing.
- If you created a new Amazon Q application for your testing, delete the application.
Conclusion
In this post, we discussed how to configure the Amazon Q Business Microsoft Teams connector to index chat, messages, wiki, and files. We showed how Amazon Q enables you to discover insights from your Microsoft Teams workspace quicker and respond your needs faster.
To further improve the search relevance, you can enable metadata search, which was announced on October 15, 2024. When you connect Amazon Q Business to your data, your data source connector crawls relevant metadata or attributes associated with a document. Amazon Q Business can now use the connector metadata to get more relevant responses for user queries. Refer to Configuring metadata controls in Amazon Q Business for more details. You can also use the metadata boosting feature. This allows you to fine-tune the way Amazon Q prioritizes your content to generate the most accurate answer.
To learn more about the Amazon Q Business Microsoft Teams connector, refer to Connecting Microsoft Teams to Amazon Q Business. We also recommend reviewing Best practices for data source connector configuration in Amazon Q Business.
About the Author
Genta Watanabe is a Senior Technical Account Manager at Amazon Web Services. He spends his time working with strategic automotive customers to help them achieve operational excellence. His areas of interest are machine learning and artificial intelligence. In his spare time, Genta enjoys spending quality time with his family and traveling.
Subscribe to our email newsletter to get the latest posts delivered right to your email.
Comments