Azure / Azure/azure-cli

Cannot pass inline JSON parameters to az deployment group create

Open
#17,880 5 comments 1 reaction 1 assignee Claimed by @zhoxing-ms View on GitHub
act-identity-squad ARM feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Describe the bug**

Passing parameters as inline JSON to `az deployment group create` following the examples in the documentation does not seem to work in `bash` (running on Windows in WSL - similar errors are also observed in `cmd`, but for clarity have not been included in this issue).

**To Reproduce**

Using the following template file:

```
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"managedIdentityName": {
"type": "string"
}
},
"resources": [
{
"apiVersion": "2018-11-30",
"name": "[parameters('managedIdentityName')]",
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"location": "[resourceGroup().location]",
"properties": {}
}
]
}
```

The documentation [examples](https://docs.microsoft.com/en-us/cli/azure/deployment/group?view=azure-cli-latest#az_deployment_group_create-examples) suggest that parameters can be passed inline as follows:

az deployment group create --resource-group testrg --template-file "template.json" --parameters '{ \"managedIdentityName\": \"test-identity\" }'

However this gives the following error:

Unable to parse parameter: { \"managedIdentityName\": \"test-identity\" }

Issue #15808 suggests that this should instead be

az deployment group create --resource-group testrg --template-file "template.json" --parameters '{ "managedIdentityName": "test-identity" }'

However this gives the following error:

{"error":{"code":"InvalidRequestContent","message":"The request content was invalid and could not be deserialized: 'Error converting value \"test-identity\" to type 'Azure.Deployments.Templates.Definitions.DeploymentParameterDefinition'. Path 'properties.parameters.managedIdentityName', line 1, position 69.'."}}

**Expected behavior**

It should be possible to pass JSON deployment parameters inline.

**Environment summary**

Ubuntu 18.04.5 LTS
Linux-4.4.0-19041-Microsoft-x86_64-with-debian-buster-sid
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
Python (Linux) 3.6.10 (default, Apr 19 2021, 07:29:42)
[GCC 7.5.0]

azure-cli 2.22.1
core 2.22.1
telemetry 1.0.6

Note that the Azure CLI tested is installed in WSL using `apt`.

**Additional context**

None.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.