Questions tagged [azure-cli2]

Azure CLI 2.0 is optimized for managing and administering Azure resources from the command line, and for building automation scripts that work against the Azure Resource Manager.

https://learn.microsoft.com/en-us/cli/azure/overview?view=azure-cli-latest

156 questions
153
votes
7 answers

Azure Cli how to change subscription default

I have 3 subscription in my Azure Account, I need to change the default subscription. When i Run the command: azure account list I have this output: I have tried to change the default or current subscription on this way, with no results... azure…
chemitaxis
  • 13,889
  • 17
  • 74
  • 125
82
votes
12 answers

Azure CLI vs Powershell?

Not precisely able to understand the merit of Azure CLI on Windows environment. Is it targetted for the audience who want to manage Azure IAAS from Linux environment? I thought Powershell core is going to be the way for non-Windows admins. Is…
Abhijeet
  • 13,562
  • 26
  • 94
  • 175
35
votes
3 answers

AKS. Can't pull image from an acr

I try to pull image from an ACR using a secret and I can't do it. I created resources using azure cli commands: az login az provider register -n Microsoft.Network az provider register -n Microsoft.Storage az provider register -n Microsoft.Compute az…
typik89
  • 907
  • 1
  • 10
  • 23
21
votes
6 answers

Azure CLI how to check if a resource exists

I'm starting to write a bash script to provision a VM in a new or existing resource group so that we can enforce naming convention and configuration. In a bash script how can I check that a resource already exists so I don't try to create it…
Jeremy
  • 44,950
  • 68
  • 206
  • 332
20
votes
7 answers

Service Principal az cli login failing - NO subscriptions found

Trying to perform an az cli login using a Service Principal and it is throwing an error stating No subscriptions found for . If this is expected, use '--allow-no-subscriptions'. This code has worked fine previously but now…
phydeauxman
  • 1,432
  • 3
  • 26
  • 48
19
votes
7 answers

SSL handshake error with some Azure CLI commands

I am using Azure CLI in bash within PowerShell in Windows 10. I sit behind a corporate proxy. My goal is to automate the deployment and setup of Azure resources. Some of the Azure CLI commands work perfectly fine: I can run az login, change the…
18
votes
4 answers

How to get public ip address for virtual-machine using Azure CLI command

I want to get public IP address for a specific virtual machine in Azure bash command line, I have used this command so far but it returns network interface information: az vm list-ip-addresses -g dev-rg -n dev-vm returned value: [ { …
Ehsan Zargar Ershadi
  • 24,115
  • 17
  • 65
  • 95
9
votes
5 answers

How to create scope using Azure CLI (az ad app)

Using the Azure CLI 2.x, I cannot find a way to "add a Scope" under the expose an API section in Azure AD Portal. What I do see is if I pass the --identifier-uris when the app is created, the APP ID URI and a Scope get automatically set: `az ad…
9
votes
4 answers

Set Output Variable in Azure CLI task on VSTS

I am getting crazy to achieve this very simple task. I need to set an Output Variable in an Azure CLI task on Visual Studio Team Services, because next task in the Release definition will be executed according to the value of this variable. I wrote…
6
votes
1 answer

How to tell if my VM is Gen1 or Gen2 in Azure?

I would like to figure out if my Azure VM (Windows + Linux) is Gen1 or Gen2. Ideally I want to get this to work via az cli or from the actual server itself. I have tried az vm list -g RG-Name -d but it does not really display this information. Does…
souser
  • 5,868
  • 5
  • 35
  • 50
5
votes
3 answers

How to perform substring like function in jmespath on a string

I would like to know if there is substring function one can leverage in JMESPATH (supported by az cli). I have the below az cli request and I want to just extract the name of the linked subnet with a security group, but unlike other cloud providers…
koss
  • 107
  • 1
  • 7
5
votes
4 answers

SCM_DO_BUILD_DURING_DEPLOYMENT is set to false explicitly by Azure Cli

I am using Azure Cli in Jenkins build to deploy my nodejs azure functions to azure. I need Kudu to build the npm packages to reduce the deployment time on Jenkins side. I have SCM_DO_BUILD_DURING_DEPLOYMENT = true in Azure Functions configurations…
Mori
  • 2,484
  • 5
  • 28
  • 45
5
votes
1 answer

C# console application authentication session

How could someone implement the az login (Azure CLI) experience in a C# Console application? In that case, a browser window is opened, the user authenticates and after that he can access the private resources. My guess is that the authentication…
fra
  • 3,488
  • 5
  • 38
  • 61
5
votes
2 answers

How to stop a functionapp in a slot using azure CLI

I would like to issue a command using Azure CLI that stops a functions app in a particular deployment slot only. The Azure CLI 2.0 documentation Azure CLI 2.0 documentation lists the command: az functionapp stop --name …
ubienewbie
  • 1,771
  • 17
  • 31
4
votes
2 answers

Azure CLI 2.x is not installed on this machine

I'm trying to upload blobs using "az storage blob upload-batch". I got below two exceptions. ##[error]Azure CLI 2.x is not installed on this machine. ##[error]Script failed with error: Error: Unable to locate executable file: 'pwsh'. Please verify…
1
2 3
10 11