This command fails
az webapp create --resource-group my-rg -n my-app --plan my-plan
with error
ResourceNotFound - The Resource 'Microsoft.Web/sites/my-app'
under resource group 'my-rg' was not found.
To me this doesn't make sense. The very purpose of this command is to create the webapp, so obviously it should not expect it to exist before executing the command. Did I miss somthing ?
What I think is happening - the App Service name is already taken and it spits out this silly error, try changing the name to something unique and it will work.
ps. figured it out with a --debug added to the command
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 am trying to connect my non aks k8s cluster to azure arc. I want to attempt to do this entirely through the cli. Looking at the quickstart-connect-cluster guide it skips right from resource group creation to the az connectedk8s connect step.
When attempting to connect to my cluster currently I get the following error:
$ az connectedk8s connect --name $STACK_NAME --resource-group $STACK_NAME --location eastus --tags Datacenter=miami-lab City=Miami StateOrDistrict=Florada CountryOrRegion=USA
This operation might take a while...
Problem loading the kubeconfig file.module 'collections' has no attribute 'Hashable'
I believe I may need to run some other az command to create any resources I may be missing under https://portal.azure.com/#view/Microsoft_Azure_HybridCompute/AzureArcCenterBlade/~/allresources
Am I missing some other resources I need to create before running the above command? If so, what is the az command needed to create these missing resrouces?
I'm facing an issue while run the given below command on azure powershelll to create an alert ,it was working as anticipated day before yesterday.
though surprised it has stopped working
ERROR
ERROR: 400 Client Error: Bad Request for url:
https://management.azure.com/subscriptions/09251b4d-e2aa-4e1d-a447-2abef1a761ec/resourcegroups/vmrg/providers/Microsoft.Resources/deployments/my-dep?api-version=2018-05-01
i use the following command on powershell
az group deployment create --name my-dep -g vmrg --template-file C:\HM\ARM\VMAlertArm\xyz.json --parameters C:\HM\ARM\VMAlertArm\xyz.parameters.json
What am i missing???
Thanks
Try appending "--debug" param at the end of your cli command to enable debug log so that you can see the detailed error message. For instance :
az group show --name 'abc' --debug
And we can find underlying http request log and detailed error messages :
Hope it helps .
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 get this error in windows CMD "stat: path too long for Windows" whenever I execute this command below in my azure cli in windows CMD.
az group deployment create -g "testacsengine" --template-file azuredeploy.json --parameters #azuredeploy.parameters.json
In windows, if you already install the Azure CLI model, you can execute the CLI command in CMD or Windows PowerShell ISE.
For the deployment of Azure template, you can just use the command az group deployment create -g "charlesTest" --template-file template.json in the directory of your template.
Or use the absolute path like this az group deployment create -g "charlesTest" --template-file D:\template.json. Of curse, you need to get authentication with the command az login first.
If you still get the error when you do this, the error must be inside your template. You should check your template correctly.
For more details about template deployment, see az group deployment create.