Install Foundry Agents in SharePoint and Teams
Build the .sppkg package from the GitHub repository, deploy it to the tenant app catalog, then approve its three API permissions. Grant users the Foundry User role (formerly Azure AI User) on the Azure AI Foundry project. Add the web part to a page, enter the agent ID and project endpoint URL, then sync the solution to Teams.
Before you start
- A Microsoft 365 tenant with SharePoint Online and Microsoft Teams.
- An Azure subscription with at least one Azure AI Foundry project and an agent created in that project.
- An admin account that can deploy to the app catalog and approve Microsoft Graph API permissions.
- Permission to assign Azure roles on the Foundry resource (for example, the Owner role).
- Node.js 22 (version >=22.14 and <23) and Git to build the package.
Step 1: Get the project endpoint and the agent name
Open your project in Azure AI Foundry. Copy the project endpoint URL. It has the form https://<resource>.services.ai.azure.com/api/projects/<project>.
Also note the agent name as it appears in Foundry, for example hr-assistant. The web part references the agent by this name.
The project must exist before you deploy the package. Without it, the Azure Machine Learning Services permission isn't recognized.
Check: You have a URL that ends with /api/projects/<project name> and the exact name of an agent.
Step 2: Build the .sppkg package
The repository doesn't publish releases: you build the package from source.
Clone the repository, install the dependencies, then run a production build.
git clone https://github.com/Youssef-El-Garmit/spfx-foundry-agents.git
cd spfx-foundry-agents
npm ci
npx gulp bundle --ship
npx gulp package-solution --shipCheck: The file sharepoint/solution/spfx-foundry-agents.sppkg exists.
Step 3: Deploy the solution to the app catalog
Open the tenant app catalog. Upload the spfx-foundry-agents.sppkg file.
In the dialog, select the option that makes the solution available to all sites in the organization, then select Deploy. This tenant-wide deployment is also required to use the solution in Teams.
Check: The “Foundry Agents by Nemoura” solution appears in the app catalog, with nothing in the App Package Error Message column.
Step 4: Approve the API permissions
Deployment creates three permission requests. Open the SharePoint admin center, go to the API access page, and approve them.
Azure Machine Learning Services / user_impersonation: call your Foundry agents on behalf of the signed-in user.
Microsoft Graph / User.Read: user profile and audience targeting.
Microsoft Graph / Files.ReadWrite.All: attachments, the document panel, and delegated function calls on files.
These are delegated permissions: users never get more than their own access rights.
Check: All three requests appear in the list of approved requests on the API access page.
Step 5: Give users access to the Foundry project
In the Azure portal, open the Foundry resource, then Access control (IAM). Add a Foundry User role assignment. Microsoft renamed this role: it used to be called Azure AI User, and the project README still uses the old name.
Under Members, choose User, group, or service principal. Select the users or a Microsoft Entra group, then Review + assign.
Seeing the web part only requires access to the page. Chatting with an agent requires this role.
Check: The role appears on the resource's Role assignments tab for the selected users or group.
Step 6: Add the web part and configure an agent
Edit a SharePoint page and add the Foundry Agents web part (Advanced category). In the “Agent configuration” section, select “Add agent”.
Fill in “Display name”, “Agent ID” (the agent name in Foundry), and “Endpoint URL” (the project endpoint). These three fields are required.
The “Audience” field is optional: if left empty, the agent is offered to everyone. Otherwise, choose users, Microsoft Entra groups, or SharePoint groups.
Message suggestions, the icon, attachments, function calls, and voice dictation are optional. Function calls are disabled by default, and the DELETE and PATCH methods are blocked by default.
You can export and import the configuration as a JSON array, which makes it easy to reuse on another page.
[
{
"displayName": "HR Assistant",
"agentId": "hr-assistant",
"endpointUrl": "https://<resource>.services.ai.azure.com/api/projects/<project>",
"iconType": "fluent",
"fluentIconName": "Bot24Regular"
}
]Check: Once the page is published, a user with the role sends a message and receives a streamed response.
Step 7: Make the solution available in Teams
In the app catalog, select the package, then Sync to Teams on the Files tab of the ribbon.
In Teams, open Apps: after a few minutes, the app appears under the apps built for your organization.
For a channel tab, select + in the channel, choose the app, then Add and Save. To configure the tab, right-click its name and choose “Settings”.
The solution also works as a Teams personal app. In that case, you configure it from the app's “Settings” button.
Check: A sync success message appears and the app is available in Teams.
Common errors
- The admin center shows “The requested permission isn't valid” for Azure Machine Learning Services.
- This permission is valid only once at least one Azure AI Foundry project exists in the tenant. Create the project, then redeploy the package.
- The SharePoint admin can't approve the Microsoft Graph permissions.
- For Microsoft Graph and other Microsoft APIs, approval requires a Global Administrator. The SharePoint Administrator role alone isn't enough.
- The web part displays, but the agent doesn't respond.
- Check that the user has the Foundry User role (formerly Azure AI User) on the resource or project, and that the agent ID and endpoint URL are correct.
- Sync to Teams fails after a package update.
- Delete the previous version of the app in Teams (Add a tab, More apps, … menu, Delete), then run the sync again.
Sources
- spfx-foundry-agents GitHub repository (README) (opens in a new tab)
- Requested permissions (package-solution.json) (opens in a new tab)
- Role-based access control for Microsoft Foundry (opens in a new tab)
- Connect to Microsoft Entra ID-secured APIs in SharePoint Framework solutions (opens in a new tab)
- Manage access to Microsoft Entra ID-secured APIs (opens in a new tab)
- Build Microsoft Teams tab using SharePoint Framework (opens in a new tab)