Search code examples
powershellazureazure-resource-managerazure-rm-templateazure-devtest-labs

Remove-AzureRmResourceGroupDeployment not removing the azure dev test lab


I created a dev test lab from powershell using the command :

New-AzureRmResourceGroupDeployment -Name MyLab -ResourceGroupName MyLabRG -TemplateUri https://raw.githubusercontent.com/azure/azure-quickstart-templates/master/101-dtl-create-lab/azuredeploy.json

Now after I am done doing some operations in the lab, I want to delete it. So I use

Remove-AzureRmResourceGroupDeployment -Name MyLab -ResourceGroupName MyLabRG 

It returns True, but when I check the Dev Test lab in portal, it is still there. Am I missing something?


Solution

  • If you want to remove the dev test lab, please have a try to use the following command, it works correctly on my side.

    Remove-AzureRmResource -ResourceGroupName $resourcegroupName -ResourceType Microsoft.DevTestLab/labs -ResourceName $resourceName -ApiVersion 2016-05-15 -Force