To use the Microsoft Teams tool recipe, perform the following prerequisite tasks:
1Import Python external libraries.
2Find the Azure tenant ID and client ID.
3Verify and add API permissions.
4Enable authentication.
Step 1. Import Python external libraries
Before you run the Python script in the Microsoft Teams tool, ensure that your Python environment contains the following libraries:
•requests
•PyJWT
•time
If these libraries are not installed, you can install them using the following command:
./<Latest AI Agent Runtime service version>/pythonRuntime/python/bin/pip install requests PyJWT time
Step 2. Find the Azure tenant ID and client ID
To configure the Microsoft Teams tool, you need to get your tenant ID (directory ID) and client ID (application ID) from the Azure portal. These identifiers authenticate your application and enable secure access.
Finding your tenant ID (directory ID)
1Open the Azure portal.
2Search for and select Microsoft Entra ID.
3On the Entra ID Overview page, copy the Directory (tenant) ID.
Finding your client ID (application ID)
1In the Azure portal, go to Microsoft Entra ID > App registrations.
2Select an existing app or click New registration to create a new one.
3Select your app, and then click Overview.
4Copy the Application (client) ID from the Essentials section.
You will need both the tenant ID and client ID to configure the Microsoft Teams tool.
Step 3. Verify and add API permissions
1In the Azure portal, go to Microsoft Entra ID > App registrations, and select your application.
2From the left menu, under Manage, select API permissions.
3Review the Configured permissions list to ensure the following permissions are present. If not, add them:
- offline_access
- User.Read
- ChannelMessage.Send
4To add permissions, select Add a permission, choose Microsoft Graph, select Delegated permissions, find the permissions in the list, check the boxes, and select Add permissions.
Step 4. Enable authentication
1In your app registration's left menu, under Manage, select Authentication.
2In the Advanced settings section, enable the Allow public client flows option.