Azure-cli: ARM template creation and validation cannot parse parameters file

Created on 15 Nov 2018  路  6Comments  路  Source: Azure/azure-cli

Describe the bug
Using the Azure Cloud Shell, I'm trying to using the az group deployment validate and az group deployment create commands to validate and provision resources using a ARM template. The ARM template exists on a public blob container and is accessible everywhere. However when I specify the parameters file using the @{file} syntax, various errors occur.

To Reproduce
Using the Azure Cloud Shell with PowerShell, execute this command:
az group deployment validate --resource-group <rg> --template-uri "https://<sa>.blob.core.windows.net/<container>/azuredeploy.json" --parameters ``@{"https://<sa>.blob.core.windows.net/<container>/arm/azuredeploy.parameters.dev.json"} -o text

_Please note:_ that the code sample above includes two backticks, instead of one, because the editor doesn't allow me to add a single backtick.

This will result in a error (regardless whether I specify the -o text or not):

az group deployment validate: 'utputformat' is not a valid value for '--output'. See 'az group deployment validate --help'.

Using a local parameters file results in the same error:
az group deployment validate --resource-group <rg> --template-uri "https://<sa>.blob.core.windows.net/<container>/azuredeploy.json" --parameters ``@{"azuredeploy.parameters.dev.json"} -o text

Using the Azure Cloud Shell with Bash, execute this command:
az group deployment validate --resource-group <rg> --template-uri "https://<sa>.blob.core.windows.net/<container>/azuredeploy.json" --parameters @{"https://<sa>.blob.core.windows.net/<container>/arm/azuredeploy.parameters.dev.json"}

This will result in a different error:

Unable to parse parameter: @{https://<sa>.blob.core.windows.net//arm/azuredeploy.parameters.dev.json}

Expected behavior
Parsing the command will succeed, the parameters file is read and the create/validate commands will execute.

Environment summary
Shell Type: Powershell and Bash
CLI version: Azure Cloud Shell (shell.azure.com)

PS Azure:> az --version
azure-cli (2.0.50)

acr (2.1.8)
acs (2.3.11)
advisor (2.0.0)
ams (0.3.0)
appservice (0.2.6)
backup (1.2.1)
batch (3.4.1)
batchai (0.4.4)
billing (0.2.0)
botservice (0.1.1)
cdn (0.2.0)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.19)
consumption (0.4.0)
container (0.3.8)
core (2.0.50)
cosmosdb (0.2.3)
dla (0.2.3)
dls (0.1.4)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.3.1)
extension (0.2.3)
feedback (2.1.4)
find (0.2.12)
hdinsight (0.1.0)
interactive (0.4.0)
iot (0.3.4)
iotcentral (0.1.3)
keyvault (2.2.6)
lab (0.1.3)
maps (0.3.2)
monitor (0.2.6)
network (2.2.8)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.2)
rdbms (0.3.4)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.6)
role (2.1.9)
search (0.1.1)
servicebus (0.3.2)
servicefabric (0.1.7)
signalr (1.0.0)
sql (2.1.5)
storage (2.2.4)
telemetry (1.0.0)
vm (2.2.7)

Python location '/opt/az/bin/python3'
Extensions directory '/home/csaex39gt/.azure/cliextensions'

Python (Linux) 3.6.5 (default, Nov 1 2018, 22:27:27)
[GCC 5.4.0 20160609]

Legal docs and information: aka.ms/AzureCliLegal

Additional context
I can't find any examples in the documentation using remote parameter files, but since using remote template files is possible, I assume remote parameter files should also work. Please also note I've included an example that uses a local parameter file, but resulting in the same error.

ARM Resource Manager-cli question

Most helpful comment

I'm encountering the same issue with the following command:
az acr task create `

--registry $ACR_NAME `
--name taskhelloworld `
--image whatos:{{.Run.ID}} `
--context "https://github.com/$GIT_USER/$GIT_REPO.git" `
--branch master `
--file v1/Dockerfile `
--git-access-token $GIT_PAT --output table

az acr task create: 'utputformat' is not a valid value for '--output'. See 'az acr task create --help'.

With the debug switch, I see:
Loaded module 'vm' in 0.017 seconds.
Loaded all modules in 0.332 seconds. (note: there's always an overhead with the first module loaded)
Extensions directory: 'C:\Users\brian.azure\cliextensions'
Found 1 extensions: ['dev-spaces-preview']
Event: CommandLoader.OnLoadCommandTable []
Loaded extension 'dev-spaces-preview' in 0.003 seconds.
Event: CommandInvoker.OnPreCommandTableTruncate []
Event: CommandInvoker.OnPostCommandTableCreate [.add_subscription_parameter at 0x033CAAE0>, s_argument..add_ids_arguments at 0x032F1DF8>]
Event: CommandInvoker.OnCommandTableLoaded []
Event: CommandInvoker.OnPreParseArgs []
az acr task create: 'utputformat' is not a valid value for '--output'. See 'az acr task create --help'.

az --version
PS C:\Working> az --version
azure-cli (2.0.49)

acr (2.1.7)
acs (2.3.9)
advisor (0.6.0)
ams (0.2.4)
appservice (0.2.5)
backup (1.2.1)
batch (3.4.1)
batchai (0.4.4)
billing (0.2.0)
botservice (0.1.1)
cdn (0.2.0)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.7)
core (2.0.49)
cosmosdb (0.2.2)
dla (0.2.3)
dls (0.1.4)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.3.0)
extension (0.2.2)
feedback (2.1.4)
find (0.2.12)
hdinsight (0.1.0)
interactive (0.3.31)
iot (0.3.3)
iotcentral (0.1.3)
keyvault (2.2.5)
lab (0.1.2)
maps (0.3.2)
monitor (0.2.5)
network (2.2.7)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.1)
rdbms (0.3.2)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.5)
role (2.1.8)
search (0.1.1)
servicebus (0.3.1)
servicefabric (0.1.6)
signalr (1.0.0)
sql (2.1.5)
storage (2.2.3)
telemetry (1.0.0)
vm (2.2.6)

Extensions:
dev-spaces-preview (0.1.5)

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\brian.azure\cliextensions'

Python (Windows) 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal

I am running this on PowerShell 6.1 on Window 10
PS C:\Working> $HOST.Version

Major Minor Build Revision


6 1 0 -1

All 6 comments

1) remote parameter files are not supported
2) text is not a valid output format

  1. remote parameter files are not supported
  2. text is not a valid output format

Ok sure, that's what I thought. However even with local parameter files and without specifying the output parameter, the same error is displayed. So what else is going wrong?

I'm encountering the same issue with the following command:
az acr task create `

--registry $ACR_NAME `
--name taskhelloworld `
--image whatos:{{.Run.ID}} `
--context "https://github.com/$GIT_USER/$GIT_REPO.git" `
--branch master `
--file v1/Dockerfile `
--git-access-token $GIT_PAT --output table

az acr task create: 'utputformat' is not a valid value for '--output'. See 'az acr task create --help'.

With the debug switch, I see:
Loaded module 'vm' in 0.017 seconds.
Loaded all modules in 0.332 seconds. (note: there's always an overhead with the first module loaded)
Extensions directory: 'C:\Users\brian.azure\cliextensions'
Found 1 extensions: ['dev-spaces-preview']
Event: CommandLoader.OnLoadCommandTable []
Loaded extension 'dev-spaces-preview' in 0.003 seconds.
Event: CommandInvoker.OnPreCommandTableTruncate []
Event: CommandInvoker.OnPostCommandTableCreate [.add_subscription_parameter at 0x033CAAE0>, s_argument..add_ids_arguments at 0x032F1DF8>]
Event: CommandInvoker.OnCommandTableLoaded []
Event: CommandInvoker.OnPreParseArgs []
az acr task create: 'utputformat' is not a valid value for '--output'. See 'az acr task create --help'.

az --version
PS C:\Working> az --version
azure-cli (2.0.49)

acr (2.1.7)
acs (2.3.9)
advisor (0.6.0)
ams (0.2.4)
appservice (0.2.5)
backup (1.2.1)
batch (3.4.1)
batchai (0.4.4)
billing (0.2.0)
botservice (0.1.1)
cdn (0.2.0)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.7)
core (2.0.49)
cosmosdb (0.2.2)
dla (0.2.3)
dls (0.1.4)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.3.0)
extension (0.2.2)
feedback (2.1.4)
find (0.2.12)
hdinsight (0.1.0)
interactive (0.3.31)
iot (0.3.3)
iotcentral (0.1.3)
keyvault (2.2.5)
lab (0.1.2)
maps (0.3.2)
monitor (0.2.5)
network (2.2.7)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.1)
rdbms (0.3.2)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.5)
role (2.1.8)
search (0.1.1)
servicebus (0.3.1)
servicefabric (0.1.6)
signalr (1.0.0)
sql (2.1.5)
storage (2.2.3)
telemetry (1.0.0)
vm (2.2.6)

Extensions:
dev-spaces-preview (0.1.5)

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\brian.azure\cliextensions'

Python (Windows) 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal

I am running this on PowerShell 6.1 on Window 10
PS C:\Working> $HOST.Version

Major Minor Build Revision


6 1 0 -1

It's a powershell issue. I'm not familiar enough with Powershell to know why, but the command works when you use bash or a normal cmd prompt.

@HermanCordes you are not using the CLI's @ syntax correctly.

incorrect: @{"my/path"}
correct: @"my/path"

Indeed, the root cause is the same for both this and #8778. The curly brace syntax seen in examples denotes placeholders. You should replace the placeholder with the actual value _sans curly braces_. Powershell throws some additional Powershell-style arguments into the command line if you don't and that's where this error comes from.

Was this page helpful?
0 / 5 - 0 ratings