1
votes

I am trying to delete a previously created RM resource group with powershell. The Remove-AzureRmResourceGroup command seems forever and control is not returned to the console. Following is the script used to delete the resource group.

Login-AzureRmAccount
$resourceGroupName="dummyResourceGroup"
Get-AzureRmSubscription –SubscriptionName "Visual Studio Enterprise: BizSpark"| Select-AzureRmSubscription
Remove-AzureRmResourceGroup -Name $resourceGroupName

I tried the following steps

  • Attempt to delete again from Azure portal, but the resource group had delete button disabled with message "Deleting" in a orange bar
  • In a new powershell window Get-AzureRmResourceGroup -Name $resourceGroupName command comes up with status

    ResourceGroupName : dummyResourceGroup Location : australiaeast ProvisioningState : Deleting

  • attempt to create another resourcegroup with same name comes up with message New-AzureRmResourceGroup : The resource group 'dummyResourceGroup' is in deprovisioning state and cannot perform this operation.

Its been almost 3 hours and I suspect that the operation is errored out and will not complete. Any pointers on how to resolve this are greatly appreciated.

1
May be you should try the same command with -Force parameter. Remove-AzureRmResourceGroup -Name $resourceGroupName -Force - Aatif Akhter
or just let it for the day and open support ticket if the issue persist. The operation should either complete or fail with reasonably good error message. Some resource groups cannot be deleted because of some service dependencies - there would be a service (like Azure ML Workspace) in the group, which service is not available through the ARM. That will block deletion of the resource group, but as I said - the error message will be reasonably good. Also check your audit logs to see if there are some new messages around that action. - astaykov
Does your resource group have a storage account, and in the storage account, there is a VHD blob which is leased? If so, you need to unlease the vhd blob, before you can delete the resource group. - Jack Zeng
@Atf I tried the -force option but there is no change in behavior. - Kamalakar Nellipudi
@JackZeng there were storage accounts in this group when i ran the command and they are deleted. Actually everything excepted NSG's are deleted. - Kamalakar Nellipudi

1 Answers

1
votes

Note: This is not exactly a solution to the problem, but the steps I took that got me out of the situation.

  • In the portal I noticed an alert about service disruption in australiaeast region which lasted for about 2 hours when I first started the deployment.
  • I continued to face the issue even after 12 hours. I was unable to delete the Resource Group either from portal nor from powershell
  • I gave up and created a new ResourceGroup and as if by magic the old ResourceGroup got deleted.