How to Add a Valid Domain to a Microsoft Teams App Manifest
Teams loads a web page for your app, such as the page inside a dialog, only from a domain your app's manifest lists in validDomains. Here's what to put in that list, and how to add it to the manifest and get the new version into Teams.
What validDomains Is
Every Teams app has a manifest.json, the file that tells Teams what the app is and what it can do. Microsoft's manifest reference describes validDomains as a list of valid domains from which the Microsoft 365 app expects to load any content.
For a bot, the list matters as soon as the bot shows a web page: Invoke and dismiss dialogs says the dialog feature requires that the domains of any URLs you want to load are included in the validDomains array in your app's manifest. A page whose domain isn't on the list never loads.
Syntax
validDomains is a property at the top level of manifest.json, beside version and bots:
"validDomains": [
"<domain>",
"<another domain>"
]
<domain>is a host name alone, such ascontoso.example.com: nohttps://, and no path.- A wildcard replaces a whole part of the name, as in
*.example.com. Each part before a wildcard must be a wildcard too:*.*.example.comis valid, butfoo.*.example.comisn't. - Only domains you control. The reference warns: Don't add domains that are outside your control, either directly or through wildcards (*).
*.onmicrosoft.comisn't yours, and neither is the whole domain of a tunnel service. - Up to 100 domains.
The Example
The app Dialog Page Demo is a bot that opens a Teams dialog with a web page, wifi.html. The bot serves the page through a dev tunnel, at:
https://cdzngt35-3980.inc1.devtunnels.ms/wifi.html
Its package, DialogPageDemo.zip, holds the manifest and two icons, and the manifest has no validDomains yet. You'll add the page's domain, raise the app's version from 1.0.0 to 1.0.1, and upload the new package.
Prerequisites
- On a Mac: jq and zip. macOS includes both; check with
jq --version. On Linux, install them with your package manager. - On Windows: PowerShell 7. Its
Set-Contentwrites UTF-8 without a byte order mark by default, as its reference says.
Step 1: Find the Domain
Take the page's address and keep only the host name, the part between https:// and the next /:
| Address | Domain |
|---|---|
https://cdzngt35-3980.inc1.devtunnels.ms/wifi.html | cdzngt35-3980.inc1.devtunnels.ms |
For a dev tunnel, that's the host in the address devtunnel host prints after Connect via browser. List that exact host, never *.devtunnels.ms: that wildcard would trust everyone's tunnels.
Step 2: Unzip the Package and Look at the Manifest
In the folder where the package is, unzip it into a folder of its own, and print the two values you'll change:
- bash / zsh
- PowerShell
mkdir DialogPageDemo
cd DialogPageDemo
unzip ../DialogPageDemo.zip
jq '{version, validDomains}' manifest.json
Archive: ../DialogPageDemo.zip
inflating: manifest.json
inflating: color.png
extracting: outline.png
{
"version": "1.0.0",
"validDomains": null
}
jq '{version, validDomains}' prints only those two properties. null means the manifest has no validDomains at all.
Expand-Archive -Path ".\DialogPageDemo.zip" -DestinationPath ".\DialogPageDemo"
$manifestPath = ".\DialogPageDemo\manifest.json"
$manifest = Get-Content -Path $manifestPath -Raw | ConvertFrom-Json
$manifest | Select-Object version, validDomains
version validDomains
------- ------------
1.0.0
Expand-Archive creates the folder and prints nothing. ConvertFrom-Json reads the manifest into $manifest, and the empty validDomains column means the manifest has no validDomains at all.
How to Edit the Manifest in a Teams App Package explains these commands in more detail.
Step 3: Add the Domain and Raise the Version
The manifest reference is clear about the version: Update or additions to your app manifest require the version to be incremented. This way, when the new app manifest is installed, it overwrites the existing one and the user gets the new functionality. So change both values together:
- bash / zsh
- PowerShell
jq '.version = "1.0.1" | .validDomains = ["cdzngt35-3980.inc1.devtunnels.ms"]' manifest.json > manifest.edited.json
mv manifest.edited.json manifest.json
jq '{version, validDomains}' manifest.json
{
"version": "1.0.1",
"validDomains": [
"cdzngt35-3980.inc1.devtunnels.ms"
]
}
.version = "1.0.1"sets the version.|passes the result on to the next change..validDomains = [ … ]adds the list, with the domain as its one item. jq adds it at the end of the manifest.> manifest.edited.json, thenmvwrite the result to a new file and put it in place of the old one. Writing straight back tomanifest.jsonwould empty it before jq reads it.
$manifest.version = "1.0.1"
$manifest | Add-Member -NotePropertyName validDomains -NotePropertyValue @("cdzngt35-3980.inc1.devtunnels.ms")
$manifest | ConvertTo-Json -Depth 10 | Set-Content -Path $manifestPath
(Get-Content -Path $manifestPath -Raw | ConvertFrom-Json) | Select-Object version, validDomains
version validDomains
------- ------------
1.0.1 {cdzngt35-3980.inc1.devtunnels.ms}
$manifest.version = "1.0.1"changes a property the manifest already has.Add-Member -NotePropertyName validDomainsadds a property it doesn't have yet. Setting$manifest.validDomainsdirectly works only when the property already exists.@("…")is a list with one item, so the manifest gets a JSON array.ConvertTo-Json -Depth 10writes every level of the manifest back. Without-Depth, PowerShell stops at two levels and warns Resulting JSON is truncated as serialization has exceeded the set depth of 2. The bot'sscopeslist then comes out as the plain text"personal"instead of a list.
The manifest now ends with the new list:

{
"$schema": "https://developer.microsoft.com/json-schemas/teams/v1.30/MicrosoftTeams.schema.json",
"manifestVersion": "1.30",
"version": "1.0.1",
"id": "33333333-3333-3333-3333-333333333333",
"developer": {
"name": "Contoso",
"websiteUrl": "https://www.example.com",
"privacyUrl": "https://www.example.com/privacy",
"termsOfUseUrl": "https://www.example.com/terms"
},
"name": {
"short": "Dialog Page Demo",
"full": "Dialog Page Demo"
},
"description": {
"short": "Shows web pages in Teams dialogs.",
"full": "Chat with Dialog Page Demo and select a card button: a Teams dialog opens with a web page in it. A sample agent built with the Microsoft 365 Agents SDK."
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"accentColor": "#00838F",
"bots": [
{
"botId": "33333333-3333-3333-3333-333333333333",
"scopes": [
"personal"
],
"supportsFiles": false,
"isNotificationOnly": false
}
],
"validDomains": [
"cdzngt35-3980.inc1.devtunnels.ms"
]
}
id and botId hold your app's own ID; 33333333-3333-3333-3333-333333333333 stands in for it here.
Step 4: Zip the Package Again
Put the three files back into a new package, at the top of the .zip, with no folder around them:
- bash / zsh
- PowerShell
zip ../DialogPageDemo-1.0.1.zip manifest.json color.png outline.png
adding: manifest.json (deflated 53%)
adding: color.png (deflated 19%)
adding: outline.png (stored 0%)
Compress-Archive -Path ".\DialogPageDemo\*" -DestinationPath ".\DialogPageDemo-1.0.1.zip"
Compress-Archive prints nothing. With \*, the three files sit at the top of the .zip.
Step 5: Upload the New Package
Upload DialogPageDemo-1.0.1.zip in Teams the way you uploaded the first version: Store → the settings icon (Manage your apps) → Upload an app → Upload a custom app, as How to Upload a Custom App in Microsoft Teams shows step by step. Teams showed the app with Add again; after Add, select Open.
The Result
With the domain on the list, Teams loads the page. The bot's card button opened the dialog, and the page was in it:

The first time a browser opens a dev tunnel's address, Dev Tunnels shows its own warning page before yours: Fixed: "You Are About to Connect to a Developer Tunnel" in a Teams Dialog explains it.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Writing https:// or a path in the list | The list is for host names | Write the host name alone |
Adding *.devtunnels.ms or another service's whole domain | You trust domains you don't control, which the reference forbids | List your own host |
Leaving version as it was | The reference requires a higher version for every change to the manifest | Raise it, for example from 1.0.0 to 1.0.1 |
Changing manifest.json but not uploading the new package | Teams keeps using the package it has | Zip and upload again |
jq … manifest.json > manifest.json | The shell empties the file before jq reads it | Write to manifest.edited.json, then mv |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| The dialog stays empty, and Teams shows If you're having issues with this app, try the desktop version | The page's domain isn't in validDomains | Add it, raise version, upload again |
| The page still doesn't load after the change | The tunnel's host changed, or the old package is still installed | Compare the host with the page's address, and upload the new package |
| Exception setting "validDomains": "The property 'validDomains' cannot be found on this object. Verify that the property exists and can be set." in PowerShell | $manifest.validDomains = … on a manifest without that property | Add it with Add-Member, as in Step 3 |
| Resulting JSON is truncated as serialization has exceeded the set depth of 2. | ConvertTo-Json without -Depth | Add -Depth 10 and write the manifest again |
Fixed: "If You're Having Issues with This App, Try the Desktop Version" in a Teams Dialog shows the empty dialog and how to tell its causes apart.
FAQ
Does my bot's messaging endpoint need to be on the list?
No. The bot's messages reach it through its messaging endpoint, whatever validDomains says. The list is for content Teams loads, such as a dialog's page.
Can I list more than one domain?
Yes, up to 100. Add each as its own item: ["contoso.example.com", "cdzngt35-3980.inc1.devtunnels.ms"].
Do I need a new entry when my dev tunnel changes?
Yes, when its host changes. A tunnel you keep, as with devtunnel host <tunnel name>, keeps its host, so the entry stays right.
Conclusion
Teams loads your app's pages only from the domains in validDomains. Add the page's host name, without https:// or a path, raise the manifest's version, zip the three files again and upload the new package.
Additional Resources
- validDomains in the app manifest, on Microsoft Learn.
- Invoke and dismiss dialogs, on Microsoft Learn.
