This flow uses Hosted agents. Review Hosted agents in Foundry Agent Service before you start.
Prerequisites
Microsoft Agent 365 is generally available.- Licensing:
- Microsoft 365 licensing that supports Microsoft Agent 365. Agent 365 works best with Microsoft E5, and at least one user in your organization must have a qualifying Microsoft Agent 365 license such as Microsoft 365 Copilot.
- A Microsoft 365 license assigned to the users who create, approve, or use the agent.
- Azure permissions:
- An Azure subscription where you can create resources.
- Owner at the subscription or resource group scope. The
azdworkflow creates Azure resources and assigns required roles automatically; Owner provides the permissions needed for both. - Foundry User or Foundry Project Manager at the Foundry project scope to create and deploy 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.For the full permission matrix, see Hosted agent permissions reference.
-
Owner or Contributor at the resource group scope to create and configure the Azure Bot Service resource. Foundry-scoped roles (Foundry User, Foundry Project Manager, and similar) don’t include
Microsoft.BotService/*permissions. -
Microsoft 365 admin permissions:
- AI Administrator or Global Administrator in the Microsoft 365 admin center to approve pending agent requests.
-
Tenant and service setup:
- Use a region that supports Hosted agents. For the current supported regions, see Hosted agents in Foundry Agent Service.
-
If the
Microsoft.BotServiceresource provider isn’t already registered in your subscription, register it:
- Local tools:
What the sample creates
The sample provisions the Azure infrastructure required by the current template and publishes a Hosted agent end-to-end. Specifically:- Creates or updates the Azure resources required by the sample template, including a Foundry account and project, model deployment, hosted agent and agent version, Azure Container Registry, Azure Bot Service resource, and Application Insights with a Log Analytics workspace.
- Creates an agent version and configures endpoint traffic to always route to that version.
- Submits an autopilot request that creates an agent blueprint in the Microsoft 365 admin center for admin approval.
Run the code sample
Follow the steps in the FoundryA365 sample README on GitHub. Follow the sample README for the complete, authoritative command sequence. After the sample completes, return here to verify the deployment and complete the admin approval flow.Provision and deploy
Depending on your tenant settings, you might need to sign in with more Azure CLI scopes before provisioning (for example, for Foundry, Microsoft Graph, and Azure Resource Manager). If
azd auth login returns an authorization error, see the sample README for the required sign-in commands and scopes.Verify deployment before approval
Verify the following before you open the Microsoft 365 admin center:- Run
azd env get-valuesand save the output. Note especially the bot app ID and messaging endpoint — you need these values in the Developer verification steps. - Confirm the
azddeployment completes successfully with no failed resources. - Confirm the sample completed the publishing step and submitted the autopilot request.
Validate the deployment
Admin approval
A Microsoft 365 admin must approve the agent blueprint before it’s available in Teams.- Sign in to the Microsoft 365 admin center and locate the pending agent blueprint request.

- Approve the request. After approval, verify your agent appears in the Agent 365 agent registry.

Developer verification
After an admin approves the request, complete these verification steps.- In the Teams Developer Portal, find your approved agent blueprint and confirm its configuration.
- Select the agent blueprint from the list.
- Verify the messaging endpoint and app ID match the values from
azd env get-values. - Save any required fields and publish the update if prompted.
- In Microsoft Teams, verify that you can find the agent and create an instance:
- Go to Apps.
- Go to Agents for your team.
- Find your agent and create an instance.

Troubleshooting
Next steps
After publishing, you can update your agent by deploying a new agent version and repeating theazd workflow. To monitor agent activity and set up observability, see Grant Agent 365 observability permissions.