I am trying to deploy Traffic manager profile using ARM template but when deploying I am getting the following error . I am referring the resourceid to "resourceTargetId". Also when I create the traffic manager profile from the portal it just seems to work with both deployed apps and no shows no errors.
ERROR
The 'resourceTargetId' property of endpoint 'Primarysite' is invalid or missing. The property must be specified only for the following endpoint types: AzureEndpoints, NestedEndpoints. You must have read access to the resource to which it refers.
ARM template
{
"$schema":"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion":"1.0.0.0",
"parameters":{
"DnsName":{
"type":"string"
},
"Name":{
"type":"String"
},
"RoutingMethod":{
"type":"String"
},
"Location":{
"type":"String"
}
},
"resources":[
{
"type":"Microsoft.Network/trafficmanagerprofiles",
"apiVersion":"2018-08-01",
"name":"[parameters('Name')]",
"location":"[parameters('Location')]",
"properties":{
"profileStatus":"Enabled",
"trafficRoutingMethod":"[parameters('RoutingMethod')]",
"dnsConfig":{
"relativeName":"[parameters('DnsName')]",
"ttl":30
},
"monitorConfig":{
"protocol":"HTTPS",
"port":443,
"path":"/",
"expectedStatusCodeRanges":[
{
"min":200,
"max":202
},
{
"min":301,
"max":302
}
]
},
"endpoints":[
{
"type":"Microsoft.Network/TrafficManagerProfiles/AzureEndpoints",
"name":"Primarysite",
"properties":{
"target":"https://website1.azurewebsites.net",
"resourceTargetId":"/subscriptions/xxxxxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxxxxxxxxx/resourceGroups/RGTest/providers/Microsoft.Web/sites/website1",
"endpointStatus":"Enabled",
"endpointLocation":"eastus"
}
},
{
"type":"Microsoft.Network/TrafficManagerProfiles/AzureEndpoints",
"name":"Secondarysite",
"properties":{
"target":"https://website2.azurewebsites.net",
"resourceTargetId":"/subscriptions/xxxxxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxxxxxxxxxx/resourceGroups/RGTest/providers/Microsoft.Web/sites/website2",
"endpointStatus":"Enabled",
"endpointLocation":"westus"
}
}
]
}
}
]
}
2
Answers
I am not sure from where you got the ARM template that is mentioned in the question. But the issue is with the name of EndpointProperties attribute in your ARM template. The attribute name should be "targetResourceId" and not "resourceTargetId".
Following are the list of supported attribute names in EndpointProperties:
More info about the attributes is available in the following EndpointProperties link.
You can also find a sample traffic manager ARM template in the following official azure quickstart templates link.
I have tried to reproduce the above one by following below steps and ,I have modified a bit in the given code
.json
file in vs codeparameter.json
in the same folder and use the below code