my string:
{"properties":{"template":{"contentVersion":"1.0.0.0","$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","resources":"{"type":"Microsoft.Network/networkSecurityGroups","name":"[parameters('GroupName')]","apiVersion":"2016-03-30","location":"[resourceGroup().Location]","properties":{"securityRules":["@{name=DenyAll; properties=}"]}}","parameters":"{"GroupName":{"defaultValue":"GroupName","type":"String"}}"},"mode":"Incremental"}}
Powershell mangles it like this when doing invoke-webrequest\restmethod:
\"{\"properties\":{\"template\":{\"contentVersion\":\"1.0.0.0\",\"$schema\":\"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\"resources\":\"{\"type\":\"Microsoft.Network/networkSecurityGroups\",\"name\":\"[parameters('GroupName')]\",\"apiVersion\":\"2016-03-30\",\"location\":\"[resourceGroup().Location]\",\"properties\":{\"securityRules\":[\"@{name=DenyAll; properties=}\"]}}\",\"parameters\":\"{\"GroupName\":{\"defaultValue\":\"GroupName\",\"type\":\"String\"}}\"},\"mode\":\"Incremental\"}}\"
Which makes Azure really unhappy. How to avoid that?
my call:
iwr $url -Headers $headers -Body $body -Method Put -ContentType 'application/json'
Basically I had to do this:
$(get-content path -Raw -ReadCount 0) | ConvertFrom-Json
and then use that to pass it