- Steps 1, 2, and 4 are the REST equivalent of the one-click Publish to Teams and Microsoft Copilot button in the Foundry portal.
- Step 3 is required when your project disables public network access (PNA). It enables public access only to the agent’s Activity Protocol endpoint, which Microsoft Copilot and Teams use to deliver messages.
- Step 5 explains the inbound and outbound network paths and the security controls that protect the public Activity Protocol route.
enable_m365_public_endpoint setting creates a scoped network exception for Microsoft 365 channel traffic, including Teams. Foundry limits the exception to the Activity Protocol route by using service-managed source IP filtering and the configured authorization requirements. You don’t enable PNA on the Foundry account or configure public ingress in your virtual network. Agent management APIs and other protocols remain private.
Microsoft 365 doesn’t support private network connectivity for agents and requires the agent endpoints it invokes to be routable over the public internet. The
enable_m365_public_endpoint setting meets this requirement only for the Activity Protocol route. Public network reachability doesn’t mean anonymous access. Requests from other public source IP addresses are blocked, and requests from an allowed service range must still pass Bot Service or Microsoft Entra authentication and authorization.Prerequisites
- Access to the Microsoft Foundry portal.
- A Foundry project configured with private networking: the project’s Foundry resource uses a private endpoint, and public network access is disabled.
- An agent in that project that you tested and want to publish. Test the agent thoroughly and select the active version that consumers interact with. For more information, see Configure your agent endpoint and settings.
- The following role assignments:
- Foundry User role on the Foundry project to create, manage, and publish agents.
The Foundry RBAC roles were recently renamed. Foundry User, Foundry Owner, Foundry Account Owner, and Foundry Project Manager were previously named Azure AI User, Azure AI Owner, Azure AI Account Owner, and Azure AI Project Manager. You might still see the previous names in some places while the rename rolls out. The role IDs and core permissions are unchanged by the rename.
- Permission to create an Azure Bot Service resource and configure its channels in the target resource group (for example, the Azure Bot Service Contributor Role, or the broader Contributor or Owner role).
- If your project disables PNA, a client that can resolve and reach the project’s private endpoint, such as a virtual machine in a connected virtual network or a workstation connected through VPN or ExpressRoute. Steps 1, 3, and 4 call project APIs that remain protected by the project’s network rules.
-
Azure CLI installed and signed in with
az loginto the subscription that contains your Foundry resource. -
The
Microsoft.BotServiceresource provider registered in your subscription:
What happens when you publish?
When you publish an agent, Foundry performs the following steps:- Validates the properties you submit, such as the display name, description, and version.
- Compiles a Teams app manifest as a
.zippackage. For more information, see App manifest schema for Microsoft Teams. - Submits the manifest to the Microsoft Copilot and Teams agent catalogs on your behalf.
- Enables the
activityprotocol, which the agent needs to exchange messages with Microsoft 365 and Teams. - Enables an authorization scheme, either
BotServiceRbacorBotServiceTenant, that controls who can call the agent, based on the scope you select.
Who can see and call the agent
The scope you select controls visibility — who can discover the agent in the Microsoft Copilot and Teams stores. Foundry sets the matching authorization scheme, which controls who can call the agent:- Just you (Foundry portal) or
publishScopeset toShared(REST API): EnablesBotServiceRbacand requires no admin approval. The agent appears in the stores only for you. If you add it to a Teams chat, participants who have the required Foundry permissions on the project can use it. - People in your organization (Foundry portal) or
publishScopeset toTenant(REST API): EnablesBotServiceTenantand requires admin approval in the Microsoft 365 admin center. After approval, the agent appears for everyone in your tenant under Built by your org, and anyone in the tenant can discover and use it.
Steps
- Get your agent’s identity and tenant ID.
- Create an Azure Bot Service resource.
- Enable the source-IP-filtered Activity Protocol public endpoint and add
BotServiceRbacorBotServiceTenantas an authorization scheme. - Call Foundry’s Microsoft 365 publish API.
- Review the network path and security controls.
Step 1: Get the agent identity and tenant ID
Before creating the Azure Bot Service resource, collect two values you’ll need in Step 2:- Agent identity client ID — the application ID of your Foundry agent’s identity
- Tenant ID — your Microsoft Entra ID tenant
1.1 Get a bearer token
The steps authenticate with a bearer token for thehttps://ai.azure.com audience. Get a token once and reuse it:
{{token}} in the requests that follow.
1.2 Get the agent identity client ID
Get the client ID by calling the Agents - Get agent API. Your{{endpoint}} is the project endpoint, in the form https://<resource-name>.services.ai.azure.com/api/projects/<project-name>.
instance_identity.client_id. You use it in the next step when you create the Azure Bot Service resource. The principal_id value isn’t used in this flow.
1.3 Get your tenant ID
To get your tenant ID, run the command:Step 2: Create the Azure Bot Service resource
The Azure Bot Service resource proxies messages between the Microsoft channel adapters (Teams and Copilot) and your agent. Create the bot with public network access disabled and connect it to the Microsoft Teams channel. The bot’sendpoint is the agent’s activity protocol endpoint, in this form:
-
Save the following template as
bot-service.bicep: -
Deploy the template to the resource group that contains your Foundry resource:
-
Capture the Azure Bot Service resource ID. You pass it as
botServiceArmIdwhen you publish in Step 4:
Step 3: Enable source IP-filtered Activity Protocol access and Bot Service authorization
For a project that disables PNA, setenable_m365_public_endpoint to true in the Activity Protocol configuration. This setting enables a source IP-filtered public path only to the Activity Protocol route. It doesn’t make the Responses, Invocations, A2A, MCP, or other project APIs public.
The setting changes network reachability, not authorization. Keep a Bot Service authorization scheme configured so Foundry can authenticate and authorize requests from Microsoft Copilot and Teams. Source IP filtering is a defense-in-depth network control and doesn’t replace token validation, tenant checks, or RBAC.
For a project that allows public network access, the Microsoft 365 publish API in Step 4 can add the activity protocol and the authorization scheme automatically. The enable_m365_public_endpoint setting isn’t required.
Interacting with an agent from Microsoft 365 and Teams requires two additions to the agent endpoint: the activity protocol, which lets the channel adapters deliver messages, and a Bot Service authorization scheme, which controls who can call the agent.
Choose one authorization scheme:
The
publishScope value in the publish request (step 4) determines both the agent’s store visibility and its authorization scheme. Tenant maps to BotServiceTenant, and Shared or Personal maps to BotServiceRbac. Publishing sets the matching scheme and replaces a different Bot Service scheme, so choose the scheme that matches the scope you plan to use to avoid an unexpected change.
In the Foundry portal, the Who can use this agent option applies these pairings: Just you applies BotServiceRbac with Shared visibility, and People in your organization applies BotServiceTenant with Tenant visibility. For more information, see Publish agents to Microsoft Copilot and Microsoft Teams.
This request replaces
protocol_configuration and authorization_schemes. Include every protocol and authorization scheme the endpoint must keep, such as responses and Entra, or the endpoint loses them.Step 4: Publish the agent to Microsoft 365
Publish the agent by calling the Microsoft 365 publish API with the{{token}} from the first step. Replace the placeholders with these values:
The agent name is part of the request URL. The service resolves the agent and its identity from that name, so you no longer pass the agent GUID or bot ID in the request body.
agentDisplayName: the display name shown in Teams and Microsoft Copilot. Optional; when omitted, the agent name is used.botServiceArmId: the ARM resource ID of the Azure Bot Service resource you created in Step 2. Required.publishScope:Shared(the portal’s Just you) makes the agent available only to you. It appears under Your agents in the agent store, and you share it with a link.Tenant(the portal’s People in your organization) submits the agent for Microsoft 365 admin approval and, once approved, makes it available to your whole organization under Built by your org.Personalis also accepted and treated asShared.appVersion: a semantic version string such as1.0.0. Increment it to update the user-facing properties; republishing an existing version returns aversion already existserror. To roll out a new agent version, update the agent version receiving traffic instead.shortDescriptionandfullDescription: descriptions shown in the agent store.developerName,developerWebsiteUrl,privacyUrl, andtermsOfUseUrl: developer metadata shown to users.publishAsAutopilot: set tofalse. To publish as an autopilot agent, see Foundry agents in Microsoft Agent 365.canRespondWithoutMention,colorIconBase64, andoutlineIconBase64: optional. Control whether an autopilot responds to all messages on its Teams surfaces or only when @mentioned, and set custom color (192×192 PNG) and outline (32×32 PNG) app icons.
titleId).
Download and inspect the app package
Download the generated app package before you publish when you want to inspect the manifest or manually upload the package to Microsoft Teams. The download endpoint accepts the same request body as the publish endpoint.-
Save the JSON request body from the publish example as
publish-request.json. -
Call the package download endpoint with the bearer token from Get a bearer token:
Expected result: The request saves the validated package as
appPackage.zip. -
Extract the package and inspect
manifest.jsonand its referenced assets. For the fields to check and the values that you shouldn’t change, see Inspect the downloaded package.
https://ai.azure.com audience. Your identity needs agent write permission on the project, such as the Foundry User role described in Prerequisites.
Step 5: Review the network path and security controls
The public Activity Protocol route is a service-managed exception to the project’s private-network restrictions. It gives Microsoft Copilot and Teams a way to deliver activities without making the project’s other endpoints public.5.1 Understand the inbound traffic flow
When a user sends a message in Microsoft Copilot or Teams, the message follows this path:- Microsoft 365 or Teams sends the activity through its channel infrastructure.
- The channel infrastructure sends an HTTPS request over the public internet to the agent’s Activity Protocol route.
- Foundry checks the originating IP address against its Azure Bot Service and Microsoft 365 source ranges.
- Foundry authenticates the request and applies the endpoint’s authorization scheme, including tenant and RBAC checks where applicable.
- Foundry routes the authorized activity to the active agent version and returns the response through the channel.
5.2 Review the inbound network requirements
Foundry manages the public entry point and the following network controls:- Public routing: Foundry exposes the Activity Protocol route over its public service endpoint. You don’t need to deploy a public IP address, public DNS record, DNAT rule, load balancer, or reverse proxy.
- TLS termination: Foundry terminates TLS and presents the certificate for the service endpoint. You don’t need to provision or rotate a certificate for this route.
- Source IP filtering: Foundry maintains the Azure Bot Service and Microsoft 365 source ranges. You don’t configure these ranges in your virtual network.
- Fail-closed handling: Foundry denies requests with an absent or malformed source IP and requests from addresses outside the allowed service ranges.
5.3 Authenticate and authorize inbound requests
Source IP filtering is necessary for this public route, but it isn’t sufficient. Requests from an allowed service range must also satisfy the endpoint’s authentication and authorization requirements. Foundry validates the signed channel token against the agent’s identity. It then applies the configured authorization scheme:BotServiceRbacrequires the caller to be in the project’s tenant and to have the required Azure permissions.BotServiceTenantrequires the caller to be in the project’s tenant.Entra, if retained on the endpoint, continues to require Microsoft Entra authentication and the applicable Azure permissions.
5.4 Understand the limits of source IP filtering
The source IP check is a defense-in-depth control, not proof of the caller’s identity. Azure Bot Service and Microsoft 365 source ranges can be shared by multiple tenants and resources. A request from an allowed range must still present a valid token for the agent and satisfy the configured tenant or RBAC authorization requirements. For example, traffic relayed through another Azure Bot Service resource can originate from an allowed address. The source IP check identifies the service network, but token validation and authorization establish whether the request is intended for your agent.5.5 Plan outbound traffic
Theenable_m365_public_endpoint setting changes only inbound reachability for the Activity Protocol route. It doesn’t change the outbound rules for your agent runtime.
Continue to allow the destinations your agent needs, such as model endpoints, tools, and data sources. Those calls follow the egress controls for your private-network configuration. For more information, see Set up private networking for Foundry Agent Service.
Verify the published agent
- In Microsoft Copilot or Microsoft Teams, open the agent store and find your agent. With
Sharedscope, it appears under Your agents. WithTenantscope, it appears under Built by your org after a Microsoft 365 admin approves it in the Microsoft 365 admin center. - Start a conversation and send a message.
- Confirm the agent replies. A reply confirms end-to-end channel delivery.