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 fine when I use it via New-AzureResourceGroup -TemplateFile website.json
.
So now I'm trying to tweak the template file to configure the site. I'm trying to set the php and .NET Framework versions. According to the schema these properties are set via a config object in a resources array.
Here's the website section of my json template. The "resources" section is what I added:
{
"apiVersion": "2014-06-01",
"name": "[parameters('siteName')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('siteLocation')]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource"
},
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"properties": {
"name": "[parameters('siteName')]",
"serverFarm": "[parameters('hostingPlanName')]"
},
"resources": [
{
"apiVersion": "2014-04-01",
"type": "Microsoft.Web/sites/config",
"name": "config",
"properties": {
"name": "config",
"phpVersion": "",
"netFrameworkVersion": "V4.5"
}
}
]
},
When I pass this template to Test-AzureResourceGroupTemplate
I get this error:
Code : InvalidTemplate
Message : Deployment template validation failed: 'The template resource 'config' for type 'Microsoft.Web/sites/config' has
incorrect segment lengths. A nested resource type must have identical number of segments as its resource name. A root
resource type must have segment length one greater than its resource name'.
I can't find any documentation on this. Does anyone know what this error means, or what I'm doing wrong?