How to deploy Traffic Manager to a Sovereign cloud using ARM template

On other day I tried to deploy Azure Traffic Manager profile to a sovereign aka national aka government cloud but got an error:

Code: BadRequest
Message: A policy with the requested domain name could not be created because the name example.trafficmanager.net does not end with the expected value .trafficmanager.cn.

That’s it, the error message describes the issue perfectly (what is not always the case for ARM): I used in sovereign cloud for China the domain name for Public. Here’s a way to use the right one:

{
   "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
   "contentVersion": "1.0.0.0",
   "parameters": {
     "resourceName": {
       "type": "string"
     },
     "cloudInstance": {
       "type": "string"
     }
   },
   "variables": {
     "tmApiVersion": "[providers('Microsoft.Network', 'trafficManagerProfiles').apiVersions[0]]",
     "endpointDomainLookup": {
       "Public": "trafficmanager.net",
       "USGov": "usgovtrafficmanager.net",
       "China": "trafficmanager.cn",
       "Germany": "azuretrafficmanager.de"
     },
     "endpointDomain": "[variables('endpointDomainLookup')[parameters('cloudInstance')]]"
   },
   "resources": [
     {
       "type": "Microsoft.Network/trafficManagerProfiles",
       "name": "[parameters('resourceName')]",
       "apiVersion": "[variables('tmApiVersion')]",
       "location": "global"
       "properties": {
         "profileStatus": "Enabled",
         "trafficRoutingMethod": "Priority",
         "dnsConfig": {
           "relativeName": "[parameters('resourceName')]",
           "fqdn": "[concat(parameters('resourceName'), '.', variables('endpointDomain'))]",
           "ttl": 30
         },
         "monitorConfig": {
           "protocol": "HTTPS",
           "port": 443,
           "path": "/ping",
           "intervalInSeconds": 30,
           "toleratedNumberOfFailures": 3,
           "timeoutInSeconds": 10
         }
       }
     },
     {
       "type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints",
       "name": "[concat(parameters('resourceName'), '/', parameters('endpoint1Name'))]",
       "apiVersion": "[variables('tmApiVersion')]",
       "properties": {
         "endpointStatus": "Enabled",
         "target": "[parameters('endpoint1Address')]",
         "weight": 1,
         "priority": 10,
         "endpointLocation": "[parameters('endpoint1Locatiom')]"
       },
       "dependsOn": [ "[parameters('resourceName')]" ]
     },
     {
       "type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints",
       "name": "[concat(parameters('resourceName'), '/Endpoint', parameters('endpoint2Name'))]",
       "apiVersion": "[variables('tmApiVersion')]",
       "properties": {
         "endpointStatus": "Enabled",
         "target": "[parameters('endpoint2Address')]",
         "weight": 1,
         "priority": 20,
         "endpointLocation": "[parameters('endpoint2Location')]"
       },
       "dependsOn": [ "[parameters('resourceName')]" ]
     }
   ]
 }
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.