Skip to content

Microsoft.Automation/automationAccounts/variables properties.value does not accept strings correctly #13534

Open
@KenBenjamin

Description

@KenBenjamin

When deploying via ARM/Bicep templates, the Microsoft.Automation/automationAccounts/variables API (all versions as of this date) don't properly handle the properties.value, which is listed in the API docs as a type string.

For example, with this template:

{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "resources": [
        {
            "type": "Microsoft.Automation/automationAccounts/variables",
            "name": "Start-Stop-VMs-Test/myVariableName",
            "apiVersion": "2015-10-31",
            "location": "westeurope",
            "properties": {
                "description": "myVariableDesc",
                "value": "myVariableValue"
            }
        }
    ]
}

You get this error:
{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"BadRequest","message":"{\"Message\":\"The request is invalid.\",\"ModelState\":{\"variable.properties.value\":[\"Invalid JSON primitive: myVariableValue.\"]}}"}]}

The issue seems to be that it's stripping the quotes off of the input JSON and exposing the raw string.

A temporary workaround is to wrap the string in extra quotes. These 3 approaches work:

  • "\"myVariableValue\""
  • "'myVariableValue'"
  • concat('"', myVariable, '"')

Credit to this StackOverflow post.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AutomationService AttentionWorkflow: This issue is responsible by Azure service team.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions