Questions tagged [azure-cli]

The Azure CLI allows Azure users to manage their Azure assets and interact with their Azure services, applications, containers, and infrastructure in an idiomatic way.

Learn more here!

2057 questions
11
votes
2 answers

Error: Unable to locate executable file: 'powershell' when running Azure CLI task in ADO pipeline

I am trying to run an Azure CLI task in pipeline and getting the following error : Starting: AzureCLI ============================================================================== Task : Azure CLI Description : Run Azure CLI commands…
Nilotpal
  • 3,237
  • 4
  • 34
  • 56
11
votes
4 answers

How to use variables with Azure CLI

I am trying to use variable in azure CLI like we used in powershell. In powershell we define variable as follows $LOCATION = value And used it in command as follows az group create --name foo --location $LOCATION What I have tried :- I have tried…
Harish
  • 789
  • 1
  • 7
  • 21
11
votes
2 answers

Pass parameter to Azure CLI Task in DevOps

How do you pass a parameter to an Azure CLI Task in Azure DevOps? Take the very basic example of showing basic info about a VM. A basic CLI command would be: az vm show --name myVM --resource-group dev -o table Now if I wanted to parameterize…
11
votes
6 answers

Assigning multiple tags to a resource via Azure CLI results in one big tag when using a variable

When creating VM via az cli (bash) with a list of tags. First set this variable: tags='env=qa servertype=frontend Distinct=qa-frontend25 CI=Yes DataDog:True' However when running the below command in bash az vm create ... --tags "${tags}" It…
J00MZ
  • 675
  • 1
  • 10
  • 27
10
votes
5 answers

Azure key vault creation error: VaultAlreadyExists - I can't find the existing vault

I'm trying to create a key vault in Azure using this CLI command... az keyvault create --location $location --name $keyVaultName --resource-group $resourceGroupMainName --output none But this returns the error... (VaultAlreadyExists) The vault…
awj
  • 7,482
  • 10
  • 66
  • 120
10
votes
2 answers

In Azure Devops, how can i use pipeline variables in a "Azure CLI task v.2" running shell script?

I am trying to execute a task using Azure CLI and bash in Azure Devops. I am using Azure CLI task v.2 and choosing shell as script type as below. I want to use pipeline variables in bash script. I run the command below inside the…
MoonHorse
  • 1,966
  • 2
  • 24
  • 46
10
votes
1 answer

AZ CLI query filter on multiple properties using &&

I am trying to create an az cli query that can evaluate if I am logged into the correct tenant and subscription. I know I have to use the ? and && operators but have not been able to get them in the correct combination yet that will work. When I…
phydeauxman
  • 1,432
  • 3
  • 26
  • 48
10
votes
1 answer

How do I run Azure Cli Script using my local Azure Cli installation

First off I feel crazy asking this, sorry if this is a really stupid question. It must be obvious as I have searched everywhere and cannot find an answer! How I am supposed to run this Azure script to create an Azure Function…
Lenny D
  • 1,734
  • 4
  • 22
  • 43
10
votes
2 answers

Error: We don't have a valid access azure with Azure CLI

I'm a newer user of Azure CLI. So, i started to used it yesterday. Everything was ok until I received a message on the console that I need to login again, using the command Azure login. I did that the message say. Open my browser and enter the…
9
votes
2 answers

ERROR: The requested resource requires user authentication: in AzureCLI task build pipeline

I am unable to trigger azure pipeline build from azureCLI task Task : - task: AzureCLI@2 inputs: azureSubscription: 'Free Trial(My subscription)' scriptType: 'pscore' scriptLocation: 'inlineScript' inlineScript: | az…
9
votes
2 answers

How to delete bicep template and the resources it has deployed

How can I delete or update bicep template and all the resources it has deployed? just like we can delete or update cloudformation and terraform template az deployment commands don't have update option and while using az deployment delete it does not…
Jazib Humayun
  • 111
  • 1
  • 2
9
votes
2 answers

Get exit code from `az vm run-command` in Azure pipeline

I'm running a rather hefty build in my Azure pipeline, which involves processing a large amount of data, and hence requires too much memory for my buildagent to handle. My approach is therefore to start up an linux VM, run the build there, and push…
mchristos
  • 1,487
  • 1
  • 9
  • 24
9
votes
4 answers

How to set up az cli concrete version in Azure DevOps

After last updates of Azure DevOps our pipelines stopped working. I am using AZURE CLI tasks. Investigation shows that az cli was updated to 2.2.0, but nothing was changed on our side. /usr/bin/az --version azure-cli …
wolszakp
  • 1,109
  • 11
  • 25
9
votes
5 answers

Difference between Azure CLI and PowerShell

I am asking this question as Windows user but I request you not to limit the answer for windows only. I tried executing Azure CLI commands in Power-Shell and they are executing successfully but not the other way around. In that case why do we have 2…
Devang
  • 299
  • 2
  • 4
  • 14
9
votes
3 answers

Create SQL Server via Azure Resource Manager (ARM) template

I am trying to create a new Azure instance of SQL Server in which I would like to then create a few new databases. I know from the Azure Portal that some sort of admin users could be: an SA user (I think this means "Server Admin" and it looks like…
TPPZ
  • 4,447
  • 10
  • 61
  • 106