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"
}
}
]
}
}
]
}