'Parameters file: Template validation failed: Required property 'type' not found in JSON
Using ARM template from here: https://raw.githubusercontent.com/elastic/azure-marketplace/7.6.0/src/mainTemplate.json
Created a parameters file (snippet only, more params in actual) for ARM template deployment thru terraform:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json##",
"contentVersion": "1.0.0.0",
"parameters": {
"_artifactsLocation": {
"value": "https://raw.githubusercontent.com/elastic/azure-marketplace/7.6.0/src/"
},
"_artifactsLocationSasToken": {
"value": ""
},
"esVersion": {
"value": "${esVersion}"
},
"esClusterName": {
"value": "${esClusterName}"
},
"loadBalancerType": {
"value": "external"
},
"loadBalancerInternalSku": {
"value": "Basic"
}
}
}
Error message: Template validation failed: Required property 'type' not found in JSON. Path 'parameters._artifactsLocation', line 7, position 5."
Do we need to specify the property "type" in parameters file?
Solution 1:[1]
no, fix this:
"_artifactsLocation": {
"value": "https://raw.githubusercontent.com/elastic/azure-marketplace/7.6.0/src/"
},
Solution 2:[2]
Fixed:
The below params are not needed:
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json##",
"contentVersion": "1.0.0.0",
"parameters": {
After removing them, no more template validation failures. Some parameters files don't need these headers.
reference: https://github.com/Azure/azure-sdk-for-python/issues/482
Solution 3:[3]
I got the similar issue when edited template via Azure portal. Edition and save caused an error:
New-AzResourceGroupDeployment: 11:31:50 PM - Error: Code=DeploymentPreflightValidationFailed; Message=The template is invalid. Error: 'Required property '$schema' not found in JSON. Path '', line 1, position 2.'
To resolve it I downloaded the template manually, edited the json via text editor and saved it as a file. With manual saving - all runs with no errors.
When compared 2 files: 1st saved manually and 2nd via Azure portal I found significant difference.
Looks like a bug in the portal work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | 4c74356b41 |
| Solution 2 | spacemtn5 |
| Solution 3 | Mr.B |
