Paul
Paul

Reputation: 3283

Run statement with multiple lines in azure cli

I am new to ARM templates and Azure CLI

This may seem a really stupid question, but I am using the tutorial here

It contains the following command

templateFile="my template file"
az deployment group create \
  --name blanktemplate \
  --resource-group myResourceGroup \
  --template-file $templateFile

I am running Azure Cli via a command prompt

How can I run this? As there are multiple lines

Paul

Upvotes: 1

Views: 3600

Answers (1)

Sunny Sharma
Sunny Sharma

Reputation: 4934

Replace the backslashs ( \ ) with backticks ( ` ) at the end of each line and you should be able to run it. Your sample code with the backticks:

templateFile="my template file" `
az deployment group create `
  --name blanktemplate `
  --resource-group myResourceGroup `
  --template-file $templateFile 

for example, the following code will execute in the cloud shell if you just copy paste

 Write-Host `
 Hello, `
 World!

enter image description here

There's another way. You can create a temporary PowerShell script file in cloud shell. Paste all the commands there as necessary and run the script file from the cloud shell.

enter image description here

enter image description here

enter image description here

enter image description here

Upvotes: 3

Related Questions