Unable to delete resource group

Jeff Fazio 31 Reputation points
2022-01-16T17:04:59.043+00:00

I'm trying to delete a resource group that only has a data collection rule still in it. I'm unable to just delete that rule so trying to delete the entire resource group. I have tried doing it from both the azure portal and cloud shell and get an error on both.

Portal Error
Failed to delete resource group AP-Sentinel-rg: Deletion of resource group 'AP-Sentinel-rg' failed as resources with identifiers 'microsoft.insights/dataCollectionRules/AP-PCI' could not be deleted. The provisioning state of the resource group will be rolled back. The tracking Id is '383068ca-dd11-432a-ad63-53f3fa729cf5'. Please check audit logs for more details. (Code: ResourceGroupDeletionBlocked) Location 'australiaeast' for which the request should be processed is not supported by this instance. (Code: UnsupportedOperatingLocation, Target: /subscriptions/f11da5aa-b142-4182-ab0b-2587ede28ef0/resourceGroups/AP-Sentinel-rg/providers/microsoft.insights/dataCollectionRules/AP-PCI)

Cloud Shell Error
Remove-AzResourceGroup: Long running operation failed with status 'Conflict'.
StatusCode: 409
ReasonPhrase: Conflict
OperationID :

Azure Resource Mover
Azure Resource Mover
An Azure service used for moving multiple resources between Azure regions.
207 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Monalla-MSFT 12,041 Reputation points
    2022-01-19T21:10:10.933+00:00

    Hello @Jeff Fazio - Thanks for reaching out.

    I see that you are unable to delete the rule and trying to delete the RG itself, please see the below to see if there is any lock applied to it.

    In order to delete the Resource group, use the below command:

    > Remove-AzResourceGroup -Name ExampleResourceGroup

    And use the below method to delete a resource.

    > Remove-AzResource -ResourceGroupName ExampleResourceGroup -ResourceName ExampleVM ` -ResourceType Microsoft.Compute/virtualMachines

    To delete a resource group, you need access to the delete action for the Microsoft.Resources/subscriptions/resourceGroups resource. You also need delete for all resources in the resource group.

    For a list of operations, see Azure resource provider operations. For a list of built-in roles, see Azure built-in roles.

    If you have the required access, but the delete request fails, it may be because there's a lock on the resources or resource group. Even if you didn't manually lock a resource group, it may have been automatically locked by a related service. Or the deletion can fail if the resources are connected to resources in other resource groups that aren't being deleted. For example, you can't delete a virtual network with subnets that are still in use by a virtual machine.

    Hope that helps.


    If the above response helped, please feel free to "Accept as Answer" so it can be beneficial to the community.

    1 person found this answer helpful.