Hello Ailing Ji,
Thank you for posting your query on Microsoft Q&A platform.
To delete a resource group, you must first remove any underlying resource locks and backup data.
When you delete a resource group, Resource Manager determines the order to delete resources. It uses the following order:
All the child (nested) resources are deleted.
Resources that manage other resources are deleted next. A resource can have the managedBy property set to indicate that a different resource manages it. When this property is set, the resource that manages the other resource is deleted before the other resources.
The remaining resources are deleted after the previous two categories.
After Resource Manager determines the order, it issues a DELETE operation for each resource. It waits for any dependencies to finish before proceeding.
User the below commands to delete resource group/resources
To delete a resource group, you need access to the delete action for the Microsoft.Resources/subscriptions/resourceGroups resource.
If you have the required access, but the delete request fails, it might be because there's a lock on the resources or resource group. Even if you didn't manually lock a resource group, a related service might automatically lock it. Or, the deletion can fail if the resources are connected to resources in other resource groups that aren't being deleted.
Thanks,
Suchitra.