Francis
Francis

Reputation: 488

Error on deployment Azure Automation Variable Assets

When I try to deploy variable to Azure Automation assets, I got and error and can't deploy my resource.

Suppose this template

{
   "name": "myVariable",
   "type": "Microsoft.Automation/automationAccounts/variables",
   "apiVersion": "2015-10-31",
   "dependsOn": [
      "[resourceId('Microsoft.Automation/automationAccounts', variables('automationAccountName'))]"
   ],
   "location": "[variables('automationLocation')]",
   "properties": {
      "isEncrypted": "false",
      "value": "8f703df8-0448-4ee3-8629-fc3f01840683"
    }
}

Deployment throw me the exception :

{\"Message\":\"The request is invalid.\",\"ModelState\":{\"variable.properties.value\":[\"Invalid JSON primitive: a7d14fb0-232e-4fa0-a748-c7c8fb2082e2.\"]}}

I have also try with :

"value": "\"8f703df8-0448-4ee3-8629-fc3f01840683\""

But any attempt fail!

Anyone know how to provisioning Variable Assets with ARM template ?

Upvotes: 5

Views: 809

Answers (2)

JordanBean
JordanBean

Reputation: 2791

If you are trying to populate the "value" key with an ARM variable or parameter, you will need to concatenate the double quotes.

{
  "name": "myVariable",
  "type": "variables",
  "apiVersion": "2015-10-31",
  "properties": {
    "value": "[concat('\"', parameters('myVariableValue'), '\"')]"
   },
   "dependsOn": [
     "[resourceId('Microsoft.Automation/automationAccounts/', parameters('automationAccountName'))]"
   ]
}

Upvotes: 0

4c74356b41
4c74356b41

Reputation: 72191

Looking at the examples you should escape the quotes:

{
  "name": "sampleVariable",
  "properties": {
    "value": "\"ComputerName.domain.com\"",
    "description": "my description",
    "isEncrypted": false
  }
}

Reference

Upvotes: 3

Related Questions