Azure Bot Setup
After the container is running, you must expose it over HTTPS, configure the Azure Bot messaging endpoint, and enable the Microsoft Teams channel. These steps wire Azure Bot Service to your container so Teams can deliver activities to it.
Step 3 — Expose the Container over HTTPS
Azure Bot Service requires the bot endpoint to be publicly reachable over HTTPS. For local development, use ngrok. For production, host the container on Azure Container Instances, Container Apps, App Service for Containers, or AKS.
Local Development — ngrok Tunnel
In a separate PowerShell window, run the following command and keep the window open while testing. Closing it stops the tunnel.
ngrok http 8080
The output shows a forwarding URL:
Forwarding https://yapping-aorta-unpicked.ngrokfree.dev -> http://localhost:8080
Copy the https://... forwarding URL. This is the bot's public address.
On the ngrok free tier, the hostname changes on every restart unless you have reserved a static domain. To use a reserved domain: ngrok http --domain=<your-reserved-domain>.ngrok-free.dev 8080
Verify the Tunnel Reaches the Container
curl -UseBasicParsing -Headers @{"ngrok-skip-browser-warning"="true"} `
https://<your-ngrok-url>/health
# Expect: {"status":"ok"}
If you get ERR_NGROK_3200 ("offline"), ngrok is not running. If you see the HTML "You are about to visit..." interstitial, this is normal for browser-like requests on the free tier and does not block Azure Bot Service, which uses a non-browser User-Agent.
Step 4 — Configure the Azure Bot Messaging Endpoint
This step tells Azure Bot Service where to forward activities from Teams. The bot endpoint URL must end in /api/messages.
A missing /api/messages suffix is the most common cause of the bot not responding.
Log into Azure CLI
az login
az account show --query "{name:name, id:id, tenant:tenantId}" --output table
The tenant value must match the MicrosoftAppTenantId you are passing to the container. If it does not match, switch subscriptions:
az account list --output table
az account set --subscription <subscription-id>
Find Your Bot Resource
az resource list --resource-type Microsoft.BotService/botServices `
--query "[].{name:name, rg:resourceGroup, location:location}" --output table
If the table is empty, no Bot resource exists yet. Create one:
az bot create `
--resource-group <your-rg> `
--name <your-bot-name> `
--app-type SingleTenant `
--appid <MicrosoftAppId> `
--tenant-id <MicrosoftAppTenantId> `
--sku F0 `
--endpoint "https://<your-public-url>/api/messages"
Update the Messaging Endpoint
Replace <rg>, <bot-name>, and the URL with your values:
az bot update `
--resource-group <rg> `
--name <bot-name> `
--endpoint "https://<your-public-url>/api/messages"
Verify the Endpoint Is Set Correctly
az bot show --resource-group <rg> --name <bot-name> `
--query "{endpoint: properties.endpoint, appId: properties.msaAppId, tenantId: properties.msaAppTenantId, appType: properties.msaAppType}" `
--output table
All four values must match:
| Bot Resource Property | Must Equal |
|---|---|
endpoint
|
https://<public-host>/api/messages
|
appId
|
The MicrosoftAppId environment variable |
tenantId
|
The MicrosoftAppTenantId environment variable |
appType
|
SingleTenant (same as MicrosoftAppType environment variable) |
Smoke-Test from Azure Portal
-
In the Azure Portal, open your Bot resource and click Test in Web Chat in the left sidebar.
-
Type
hello. -
Watch the container logs:
docker logs -f privman-teams-bot
Expected log within approximately 3 seconds:
[aiohttp.access] INFO: 172.17.0.1 - "POST /api/messages HTTP/1.1" 201 - "Microsoft-SkypeBotApi"
[azure_bot.conversation_store] INFO: Saved conversation reference: ...
If you see POST /api/messages with status 201, the endpoint is wired correctly. If you see 401, there is an App ID, password, or tenant mismatch. If nothing arrives, the endpoint URL is wrong or ngrok has stopped.
Step 5 — Enable the Microsoft Teams Channel
A Bot resource supports only the Web Chat channel by default. You must explicitly enable the Teams channel:
az bot msteams create --resource-group <rg> --name <bot-name>
Confirm the channel is enabled:
az bot show --resource-group <rg> --name <bot-name> `
--query "properties.configuredChannels"
# Expect output to include: "msteams"
Once the Teams channel is enabled, continue to User Setup to register a Teams channel and start receiving approval requests.