I\'m attempting to use the AzureResourceManager PowerShell module to create and configure a website. I started with a template file generated by Visual Studio, which works
The 'incorrect segment lengths' error message is difficult to understand for non-English native so there's explanation in plain English/json:
For example, you have a resource of type Microsoft.Network/trafficManagerProfiles resource and for some reason you need to define nested resource having type Microsoft.Network/trafficManagerProfiles/ExternalEndpoints as a separate resource.
The nested resource must have name parent_resource_name/nested_res_name
The correct (simplified) schema is:
{
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "[variables('trafManagerProfileName')]",
...
},
{
"type": "Microsoft.Network/trafficManagerProfiles/ExternalEndpoints",
"name": "[concat(variables('trafManagerProfileName'), '/Endpoint', copyIndex())]",
"dependsOn": [
"[concat('Microsoft.Network/trafficManagerProfiles/', variables('trafManagerProfileName'))]",
"[parameters('app_name')]" # where the endpoint should look at
],
...
}
p.s. you might be interested in this question as well if you need to generate nested resources dynamically based on count of third resource: How do I dynamically generate Traffic Manager endpoints in an ARM template?