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
2
votes
3 answers

Using the 'az vm run-command' with a .ps1 file

I have an issue with the az vm run-command. I have got it working inline as follows: $resource_name="winsecagentdev2" $resource_group="russellmccloydev" and: az vm run-command invoke ` -g "${resource_group}" ` -n "${resource_name}" ` --command-id…
RuSs
  • 1,725
  • 1
  • 29
  • 47
2
votes
3 answers

How to delete azure resource using tag?

Is it possible to delete my azure resources(in different resource groups) using tag? If possible, how to achieve it in powershell? I have searched but found nothing related. Maybe I have missed something basic? Any guidance will be appreciated.
2
votes
1 answer

Azure CLI storage Batch Copy not working on mac Seira

I have an AzCopy command on windows that copies all blobs from a storage account to a local network drive and tests to make sure the file doesn't already exist before copying. AzCopy /Source:https://storage.blob.core.windows.net/photos…
Andrew
  • 311
  • 2
  • 13
2
votes
1 answer

How do I specify the field types when using the Azure CLI entity insert command?

Does anyone know if there is a way to define the field types when using this Azure CLI 2.0 command az storage entity insert . . . from a Windows Power Shell prompt? When I use it, all of the fields get inserted into the table with a type of…
Curt Keisler
  • 138
  • 3
  • 9
2
votes
4 answers

Edit inbound NAT pool in vmss loadbalancer

I'm trying to add a NAT pool for port 8172 to an existing loadbalancer via Azure cli. I found what I believe is the correct command: az network lb inbound-nat-pool update --lb-name --name …
Zirc75
  • 365
  • 3
  • 13
2
votes
1 answer

How to create new vm using existing VHD image in blob storage in azure cli 2.0?

We have a custom vhd image in our blob storage and we want to create a new vm using that vhd image through cli 2.0 in azure. Can anyone point me right direction to do so or any suggestions would be appreciated.
kick07
  • 614
  • 1
  • 8
  • 19
2
votes
1 answer

"az login --allow-no-subscriptions" not supported anymore?

According to the documentation: https://learn.microsoft.com/en-us/cli/azure/#login following, should be supported but fails: az login --allow-no-subscriptions ERROR: az: error: unrecognized arguments: --allow-no-subscriptions I actually wanted to…
mart
  • 51
  • 1
  • 5
1
vote
2 answers

az account not prompting for login but still granting access

I'm building a powershell script which interacts with SQL MI There are a number of methods to do this. For various reasons I choose the .Net framework described here: https://www.sqlshack.com/connecting-powershell-to-sql-server/ To authenticate I…
1
vote
2 answers

Find cheapest spot supported size / sku via az CLI or terraform provider

Trying to automate spot instance creation using Azure CLI. Neither az vm list-sizes nor az vm list-skus --resource-type virtualMachines seems to show any "spot supported" filter(s). I looked at terraform azurerm provider, but did not find any data…
Parag Doke
  • 863
  • 7
  • 17
1
vote
1 answer

Not able to link multiple workitems to a Pull request when I create using az repos pr create

I am creating a script to do a Pull request using the below Azure CLI script. az repos pr create --description $PR_Description --merge-commit-message $PR_WorkItemNo --org $orgname --source-branch $PatchName --target-branch "main" --title $PR_Title…
1
vote
1 answer

Can we use az rest in ARM deployment scripts?

I am using ARM Deploymentscripts AzCli. Can we use az rest in ARM deployment scripts? I am getting Forbidden({"error":{"code":"Authorization_RequestDenied","message":"Insufficient privileges to complete the operation."
s-a-n
  • 767
  • 2
  • 9
  • 27
1
vote
1 answer

How to set out put variable in Azure CLI task

I'm trying to write an Azure CLI task to use for further getting account keys and so on. First want to just have an output variable from the inline script but I got this error when build the pipeline: "##[error]PowerShell exited with code '1'." "The…
Minoo
  • 45
  • 5
1
vote
1 answer

AZ REST DevOps method returns "az : Not a json response"

I'm running powershell on a windows 10 machine There is trouble running AZ REST method. This script works and was even working with the user account where its now failing and I don't know why. Here is the core function making the AZ REST…
user2503078
  • 737
  • 1
  • 8
  • 24
1
vote
1 answer

Using az vm run-command from within a .ps1 script and with .ps1 script file

I have created a VM in Azure, and I can run the following command from my local Windows 10 Powershell window: az vm run-command invoke --command-id RunPowerShellScript --resource-group $ResourceGroup --name $AD1Name --scripts "@provision.ps1" But…
1
vote
2 answers

Using Azure-Cli to deploy an azure function to azure from Jenkins

I have created a docker container and generated final artifact of my azure function app code. Azure Cli is already installed in the container. Is it possible to deploy to Azure using Azure Cli and pass the credentials along? I tried the following…
Mori
  • 2,484
  • 5
  • 28
  • 45
1 2
3
10 11