Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
I have reviewed your provided information and seem like You've correctly identified the root cause that the Microsoft 365 Developer Sandbox does not include an Azure subscription, which means you cannot create an Azure Bot resource within that tenant. The 401 error occurs because of a fundamental mismatch between the M365 Developer Sandbox and Azure Bot Service requirements.
In this context, I think you can try this approach:
Use two separate accounts: your personal Azure subscription for bot infrastructure, and the M365 sandbox for Teams sideloading.
Step 1: Create an Azure bot on your personal Azure account
- Go to portal.azure.com signed in with your personal account.
- Create a new Azure Bot resource
- After creation, go to Configuration --> note the Microsoft App ID.
- Go to Manage Password --> create a new Client Secret and save it.
- Set the Messaging endpoint to your dev tunnel URL:
https://<your-devtunnel>.devtunnels.ms/api/messages
Step 2: Configure your Bot code
Set the environment variables in your .env file:
BOT_ID=<Microsoft App ID from Step 1>
BOT_PASSWORD=<Client Secret from Step 1>
BOT_TYPE=MultiTenant
BOT_TYPE=MultiTenant
Step 3: Update the Teams app manifest
In your manifest.json, ensure the bot ID matches:
{
"bots": [
{
"botId": "<Microsoft App ID from Step 1>",
"scopes": ["personal", "team", "groupChat"]
}
]
}
Step 5: Enable Sideloading on Sandbox
- In the Teams Admin Center (signed in with your sandbox admin account)
- Go to Teams apps --> Manage apps --> Org-wide app settings
- Enable Upload custom apps
Step 6: Run and Test
- Start your dev tunnel
- Run your bot locally
- Sideload the app to Teams in the sandbox tenant
You can try the approach above and let me know if the problem still persists
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.