I want to update size of vmss from Standard_F16s_v2 to Standard_F32s_v2 I usually do it from Ui
but for some requirement I have to do it from a script so I tried to follow the documentation
https://learn.microsoft.com/en-us/cli/azure/vmss?view=azure-cli-latest
and tried to run this command
az vmss update --name MyScaleSet --resource-group MyResourceGroup --vm-sku Standard_F32s_v2
but it is not working shows error UnrecognizedArgumentError: unrecognized arguments: --vm-sku Standard_F32s_v2
The issue was with a previous version of az CLI which was resolved by upgrading it to version 2.30.0.
Test Scenario :
Related
I am trying to delete a virtual machine using the command below
az resource delete --ids /subscriptions/0b1f6471-1bf0-4dda-aec3-111111111111/resourceGroups/MyResourceGroup/providers/Microsoft.Network/virtualMachines/vmlname1 --no-wait
I am getting this error:
unrecognized arguments: --no-wait
When I remove --no-wait it works
By this link:
https://learn.microsoft.com/en-us/cli/azure/resource?view=azure-cli-latest#az-resource-delete-optional-parameters
no-wait is given as a valid parameter
--no-wait
Do not wait for the long-running operation to finish.
Can anyone tell me, whether it is possible to use --no-wait in az resource delete ?
Update:
This is the az cli version i am using:
{
"azure-cli": "2.40.0",
"azure-cli-core": "2.40.0",
"azure-cli-telemetry": "1.0.8",
Thanks
It is possible to use the --no-wait flag with the az resource delete command. My testing using the flag did not produce the error that you are seeing. Is it possible that your azure cli is not up to date?
You can upgrade your azure cli to the latest version by following these instructions.
I have reproduced in my environment and got below results:
I have one VM named srivm with Resource ID like below:
When I ran the same command as you to delete VM, I got same error as below:
az resource delete --ids /subscriptions/<subID>/resourceGroups/<rgname>/providers/Microsoft.Network/virtualMachines/<vmname> --no-wait
Response:
Note that, the current version of the Azure CLI is 2.43.0. The error may occur if the CLI version is less than latest version.
When I checked the az version, I got response like below:
To resolve the error, upgrade your CLI version to latest version with az upgrade command or download azure-cli-2.43.0.exe directly.
After installing the latest version, I'm able to delete the VM successfully after running below command:
az resource delete --ids /subscriptions/<subID>/resourceGroups/<rgname>/providers/Microsoft.Network/virtualMachines/<vmname> --no-wait
Response:
To confirm that, I checked Portal and VM deleted successfully like below:
I run following command
az vm create --resource-group MyRG --name myVMName --image windows-11:win11–21h2-pro:22000.376.2112072052
This causes following error.
API version 2022-03-01 does not have operation group 'virtual_machine_images'
I assume this means --image no more support but what's the alternative? Couldn't find anything relevant in the Auzre cli documentation about this. My az cli version seems upto date
az --version
azure-cli 2.37.0
core 2.37.0
telemetry 1.0.6
Extensions:
azure-devops 0.24.0
Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.0.0
Python location '/usr/bin/python3'
Extensions directory '/home/kali/.azure/cliextensions'
Extensions system directory '/usr/lib/python3/dist-packages/azure-cli-extensions'
Python (Linux) 3.10.5 (main, Jun 8 2022, 09:26:22) [GCC 11.3.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Update:
This error is not specific to windows-11, I am getting same error with other OS too. See image below for detailed error.
az vm create --resource-group MyRG --name myVMName --image
windows-11:win11–21h2-pro:22000.376.2112072052
The image version you are using in your cmdlet is not supported. I would suggest you use the below Azure Cli cmdlet to see the list of supported windows-11:win11-21h2-pro images to deploy a virtual machine.
az vm image list --all --offer windows-11 --sku win11-21h2-pro -o table
Below image shows when we ran the above cmdlet from Azure cloudshell:
Below image shows when we ran the above cmdlet from local AzureCLI:
Note: I have tested the above az vm image list cmdlet in local & Azure Cloudshell as well it is working fine,I am able to see the list of support images and their respective versions.
I have ran the below cmdlet, am able to deploy the virtual machine using the image (MicrosoftWindowsDesktop:windows-11:win11-21h2-pro:22000.675.220507).You just need to use the image version that is shown in the above list
az vm create --resource-group <resourcegroupName> --name <vmName> --image MicrosoftWindowsDesktop:windows-11:win11-21h2-pro:22000.675.220507
I am trying to configure a Pipeline with Jenkins and deploying it to Azure. I am at the last step of a tutorial:
https://learn.microsoft.com/en-us/azure/jenkins/tutorial-jenkins-deploy-web-app-azure-app-service
This last step is as follows, i have to enter this in the Azure CLI:
az group create --name yourWebAppAzureResourceGroupName --location region
az appservice plan create --name appServicePlanName --resource-group rgname --is-linux
az webapp create --name webAppName --resource-group rgName --plan appServicePlanName --runtime "java|1.8|Tomcat|8.5"
The last command gives me the error:
'1.8' is not recognized as an internal or external command,
operable program or batch file.
So I thought maybe Tomcat is not installed on my Azure VM, which is a Linux machine. So I used the next tutorial to install Tomcat:
https://www.howtoforge.com/tutorial/how-to-install-apache-tomcat-8-5-on-ubuntu-16-04/
After this I tried to do the --runtime command again, but I still get the same error. I have no idea how to fix this. I hope someone can help me with this problem.
I tried to check the webapp list-runtimes and I get this list:
"java|1.8|Tomcat|8.5" is in here. I've tried all of the versions, but it did not work.
EDIT: It works in the Azure Cloud Shell, but then there is another error:
Linux Runtime 'java|1.8|Tomcat|8.5' is not supported.Please invoke 'list-runtimes' to cross check
I have tried all the runtime versions, but still this error. I have also tried it with double quotes
I bet you solved your problem already, but in case others find this and are using PowerShell to run Azure CLI commands. This is what worked for me.
The problem is in how PowerShell interprets the pipe, '|', character inside the --runtime parameter, when evaluating the whole line.
Add the --% to be beginning of the command to turn off PowerShell evaluation of expressions, as suggested in the code block here.
Note: this will also stop PowerShell from evaluating any variables inside the command. What you can do is move the --runtime to the end of the line to get around this problem, e.g. like this
az webapp create -g $rg -p $appPlanName -n $appName --deployment-local-git --% --runtime "DOTNETCORE|3.0"
ok, i got it, that list is for windows webapp, not linux. for linux use:
az webapp list-runtimes --linux
so working solution:
az webapp create --name yourWebAppName --resource-group yourWebAppAzureResourceGroupName --plan yourLinuxAppServicePlanName --runtime "TOMCAT|8.5-jre8"
I am attempting to remove and set tags on a VM, but am getting the error unrecognized arguments.
For example, removing a tag:
az vm update –-resource-group MyResourceGroup –-name MyTestVM --remove tags.myNewTagName1
and setting a tag:
az vm update --resource-group MyResourceGroup --name MyTestVM –-set tags.myNewTagName1=myNewTagValue1
Both examples are from the documentation. I'm running v2.0.30 on Mac OS 10.12.x.
Can anyone else confirm this and/or have it work for them? I haven't found any bugs listed in the issues db.
Thanks!
I discovered what was wrong. The syntax of the command is correct and works. However, I copied the command out of the documentation and it has a different character for the dashes/hyphens that the AZ CLI does not accept.
If you copy the samples, just re-type the dashes with the standard ones on your keyboard.
I had posted it this as an issue here: https://github.com/Azure/azure-cli/issues/5976
The following command is based on a code snippet I found in the official documentation to create a Linux Service Fabric cluster.
Originally it was bash script, but that's not available on my private build agents (requires windows insider program??) so I switched to batch script.
I wonder why the following command fails:
d:\a\r1\a>call az sf cluster create --resource-group "ha17aztestclustergroup" --location "westeurope" --certificate-output-folder . --certificate-password "433q6D7sdNKkd-.,6ck#6" --certificate-subject-name "ha17rsomaztestsf.cloudapp.azure.com" --cluster-name "ha17aztestcluster" --cluster-size 3 --os UbuntuServer1604 --vault-name "ha17rsomaztestkeyvault" --vault-resource-group "ha17aztestclustergroup" --vm-password $VmPassword --vm-user-name "sfadmin"
ERROR: az sf cluster: error: argument subcommand: invalid choice: create
usage: az sf cluster [-h]
{select,manifest,code-version,config-version,health} ...
The exact same inline script does work on my private build agents with AZ CLI 2.0.20 installed.
Azure hosted Agents (VS2017) has AZ CLI 2.0.14 installed.
But I doubt that's the problem.
The Hosted VS2017 has Azure CLI 2.0.14 installed, there isn’t create command for az sf cluster (2.0.21 contains), you can check it by adding Azure CLI task with az sf cluster --help command to check its commands.
So, you can setup a private build agent and do build with this agent. Deploy an agent on Windows
I ran into a similar problem whilst deploying a different resource (Function Apps). There was a bug fix in a later version than what was installed on the hosted agents.
I ended up getting around this problem by either dynamically injecting this command into my scripts or by simply having an extra Azure CLI step in my Release to update Azure CLI
pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge
Unfortunately it takes nearly 5 minutes to update the Agent but all of my Releases are reliable now.