Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
You need to be part of the Frontier preview program to get early access to Microsoft Agent 365. Frontier connects you directly with Microsoft’s latest AI innovations. Frontier previews are subject to the existing preview terms of your customer agreements. As these features are still in development, their availability and capabilities may change over time.
Learn how to build, host, register, and publish an Agent 365 agent running on Google Cloud Run, using the Agent 365 CLI. Microsoft Entra & Graph provides the agent identity, permissions, and blueprint, while Google Cloud Run provides the runtime.
Goals
Learn how to use Agent 365 and Microsoft 365 as the 'control plane' and:
- Deploy agent runtime on Google Cloud Run
- Configure
a365.config.jsonfor non‑Azure hosting - Create Agent Blueprint in Entra ID
- Configure OAuth2 + inheritable permissions
- Register Bot Framework messaging endpoint pointing to GCP
- Create Agent Identity + Agent User
- Publish to Microsoft 365 app surfaces
- Test interactions end-to-end
Prerequisites
Before you begin, ensure the following Azure / Microsoft 365, Google Cloud Platform (GCP), and local environment prerequisites are met.
Azure / Microsoft 365 prerequisites
Confirm your Microsoft Entra tenant access and install the following tools to create identities, blueprints, and register your agent.
A Microsoft Entra tenant with:
- Permission / role to create applications and agent blueprints (Global Administrator or equivalent)
- You need to be part of the Frontier preview program to get early access to Microsoft Agent 365.
- At least one Microsoft 365 license available for the Agent user
GCP prerequisites
GCP project created
Cloud Run API enabled
gcloud SDK installed and authenticated:
gcloud auth login gcloud config set project <GCP_PROJECT_ID> gcloud config set run/region us-central1 # or your preferred region
Local development environment prerequisites
Code Editor: Any code editor of your choice. Visual Studio Code is recommended
(Optional) Node.js. You can use any language for your agent. This article uses Node 18+ in the following steps.
LLM API access: Choose the appropriate service based on your agent's configuration or your preferred model provider:
- OpenAI API Key: Get your OpenAI API key
- Azure OpenAI: Create and deploy an Azure OpenAI resource to get your API key and endpoint
Create & Deploy A365 Agent to Cloud Run
This example uses a minimal example agent that:
- Responds to GET
/ - Accepts Bot Framework activities on POST
/api/messages
Create project
Follow these steps to scaffold a minimal Node.js agent that runs on Cloud Run and accepts Bot Framework activities.
Create the project directory
mkdir gcp-a365-agent cd gcp-a365-agentInitialize the Node project
npm init -y npm install express body-parserCreate
index.jsconst express = require("express"); const bodyParser = require("body-parser"); const app = express(); app.use(bodyParser.json()); app.get("/", (req, res) => { res.status(200).send("GCP Agent is running."); }); // Bot Framework Activity Handler app.post("/api/messages", (req, res) => { console.log("Received activity:", JSON.stringify(req.body, null, 2)); // Echo activity const reply = { type: "message", text: `You said: ${req.body?.text}` }; res.status(200).send(reply); }); const port = process.env.PORT || 8080; app.listen(port, () => console.log("Server listening on port " + port));
Deploy to Google Cloud Run
Use gcloud run deploy to build and run the service on Cloud Run, then note the public URL for your messagingEndpoint.
Use the following commands to deploy your project to Google Cloud Run:
gcloud run deploy gcp-a365-agent ` --source . ` --region us-central1 ` --platform managed ` --allow-unauthenticatedWhen finished, note your endpoint:
https://gcp-a365-agent-XXXX-uc.run.appThis URL is the
messagingEndpointused by the Agent 365 Dev Tools CLI in the next step.
Configure for Non-Azure Hosting
Create a365.config.json in your Cloud Run project folder by running a365 config init:
{
"tenantId": "YOUR_TENANT_ID",
"subscriptionId": "YOUR_AZURE_SUBSCRIPTION_ID",
"resourceGroup": "a365-gcp-demo",
"location": "westus",
"environment": "prod",
"messagingEndpoint": "https://gcp-a365-agent-XXXX-uc.run.app/api/messages",
"needDeployment": false,
"agentIdentityDisplayName": "MyGcpAgent Identity",
"agentBlueprintDisplayName": "MyGcpAgent Blueprint",
"agentUserDisplayName": "MyGcpAgent User",
"agentUserPrincipalName": "mygcpagent@testTenant.onmicrosoft.com",
"agentUserUsageLocation": "US",
"managerEmail": "myManager@testTenant.onmicrosoft.com",
"deploymentProjectPath": ".",
"agentDescription": "GCP-hosted Agent 365 Agent"
}
The following table summarizes important configuration fields and their purpose.
| Field | Meaning |
|---|---|
messagingEndpoint |
Your Cloud Run URL + /api/messages |
"needDeployment"=false |
Tells CLI 'I host my own server; don't deploy to Azure' |
deploymentProjectPath |
Where .env stamping happens |
Run Agent 365 CLI (a365)
Use the Agent 365 CLI to create the blueprint, grant permissions, and register the Bot Framework messaging endpoint against your GCP Cloud Run URL. These steps assume a365.config.json is prepared and needDeployment is set to false.
Setup command
From the same folder, use the a365 setup all command:
a365 setup all
This command performs:
- Infrastructure (skipped because
needDeployment=false) - Create Blueprint
- Admin consent for Graph scopes
- Client secret creation
- Model Context Protocol(MCP) permissions
- Bot Framework API permissions
- Register messaging endpoint → GCP URL
Expected result:
[OK] Agent blueprint created
[OK] Messaging endpoint registered
[OK] Messaging Bot API permissions configured
Your a365.generated.config.json contains:
agentBlueprintIdbotIdbotMessagingEndpointagentBlueprintClientSecret
Publish Agent to Microsoft 365
If you want users to see your agent in:
- Microsoft 365 admin center
- Teams apps and developer portal
- Microsoft 365 Hub
Use a365 publish to publish the manifest:
a365 publish
This command registers your title and updates your manifest with:
- Bot ID
- Agent Blueprint ID
- Cloud Run messaging endpoint
Onboard the Agent
To complete the A365 agent onboarding workflow, see Onboard A365 Agents and Test agents in Teams. These guides explain how to make your agent available for your organization to discover and create an agent in Microsoft 365 and the Teams App Store.
The following example steps to onboard the Agent from Teams demonstrate how it should work:
Run a365 publish
After the agent is published, the agent is visible in Teams and Microsoft 365 admin center
Configure the notifications in Teams Developer Portal
Sign-in to the Teams Developer Portal using the following URL:
https://dev.teams.microsoft.com/tools/agent-blueprint/<YOUR_BLUEPRINT_ID>/configurationReplace
<YOUR_BLUEPRINT_ID>with your agent blueprint ID.Find the agent blue print and add API based notification URL to the
messagingEndpointvalue from youra365.config.json. This URL should be something like:https://gcp-a365-agent-XXXX-uc.run.app. See more details in Configure the Agent Identity Blueprint
Provision agent in Teams App Store
- Go to Teams and select the Teams Apps Store tab.
- Find and open your agent blueprint under Agent for your Teams.
- Send the activation request by clicking the Provision button.
Approve the activation request in Microsoft admin center
- Go to the Microsoft admin center > Agents > overview
- Ensure there are Microsoft Agent 365 Frontier licenses available for the agent user
- Approve the request from the agent blue print under the Requests tab
Create agent instance/user in Teams App Store
- Go back to Teams App Store and open your agent blueprint again.
- Select Create Instance and create new agent instance/user.
Wait for provisioning, then test:
- Search the new agent user in Teams by email.
- Send a chat message to the user.
- Verify Cloud Run logs show the incoming activity.
- Verify your bot posts a reply back. This capability requires Bot Framework SDK and environment variables not included in the minimal example included in these instructions.
Verify the agent end-to-end
Use these checks to confirm your GCP-hosted agent is reachable, receiving Bot Framework activities, and responding correctly across Agent 365 surfaces.
Verify Cloud Run connectivity
Send a GET request to the messagingEndpoint value from your a365.config.json:
curl https://gcp-a365-agent-XXXX.run.app/
The response body should include:
GCP Agent is running.
Check Cloud Run logs for incoming Bot Framework messages
You can check Google Cloud Log Explorer or run:
gcloud run services logs read gcp-a365-agent --region <your region> --limit 50
After a message hits your agent, you should see:
POST 200 /api/messages
Received activity: { ... }
Test agent from Agent 365 surfaces
Depending on your environment:
- Agents Playground
- Teams (if published)
- Agent Shell
You can now send messages and verify your Cloud Run logs. And you can also Learn how to test agents using the Microsoft Agent 365 SDK and validating your agent's functionality with the Agents Playground testing tool.
Developer Workflow
Once setup is complete, follow this workflow for iterative development:
Change your agent code
Make your code changes, save, and test locally before deploying.
Redeploy to Google Cloud Run
gcloud run deploy gcp-a365-agent --source .Test and monitor
Test via Agent 365 surfaces and monitor Google Cloud Run logs.
Note
Your identity, blueprint, bot endpoint, and permissions DO NOT need to be recreated.
Troubleshooting
Use this section to diagnose common issues when deploying and running your Agent 365 agent on Google Cloud Run, and to quickly apply fixes for connectivity, configuration, and licensing problems.
Messaging endpoint isn't hit
Check the following details:
- The endpoint is exactly:
https://<cloud-run-url>/api/messages - Cloud Run allows unauthenticated access
- No firewall rules
License assignment fails
Assign a valid Microsoft 365 frontier license manually, or use an unlicensed user path if supported.
Getting help
- If you encounter issues with the Agent 365 CLI not covered in this troubleshooting section, review open issues on GitHub or create a new issue.
More help options
Consider the following to find help:
Review sample code and documentation in the samples
Review or submit other GitHub issues in the relevant SDK repository: