I am having trouble deploying a VM using New-AzResourceGroupDeployment -TemplateParameterObject
When using -TemplateParameterFile, everything works:
New-AzResourceGroupDeployment -ResourceGroupName test -TemplateFile .\azuredeploy.json -TemplateParameterFile .\azuredeploy.parameters.json -adminPassword (ConvertTo-SecureString -Force -AsPlainText 'xxxxxxxxxxxxxxxx') -whatif
When I put the JSON into a hashtable and try to use it with -TemplateParameterObject, it doesn't work:
$a = Get-Content .\azuredeploy.parameters.json | ConvertFrom-Json -AsHashtable
New-AzResourceGroupDeployment -ResourceGroupName test -TemplateFile .\azuredeploy.json -TemplateParameterObject $a.parameters -adminPassword (ConvertTo-SecureString -Force -AsPlainText 'xxxxxxxxxxxxx') -whatif
New-AzResourceGroupDeployment:
InvalidTemplate - Long running operation failed with status 'Failed'. Additional Info:'Deployment template validation failed: 'Template parameter JToken type is not valid. Expected 'String, Uri'. Actual 'Object'. Please see https://aka.ms/resource-manager-parameter-files for usage details.'.'
The strings, etc, are all correct in the JSON but something breaks when I put it into a hashtable. Everything is in the hashtable that should be, maybe I'm just not using it correctly.
Thanks,
Joe