@David V Dellanno There is not really a cli command for this. Check if you still have a resource group that starts with MC_ followed by something that resembles your SCOM MI resource group. If that doesn't exist you have to recreate it. Just an empty resource group is enough and then try to delete your SCOM MI instance again.
If that resource group still exists with resources in it, I recommend following the procedure below:
Step1: Use the following action plan to delete the orphaned SCOM managed instances:
- Create a new empty resource group with the name "MC_<SCOM_MI_ResourceGroup_Name>_<SCOM_MI_Instance_Name>" for example "MC_ManagedInstances_scomlpatj"
- Navigate to the orphaned SCOM managed instance, select the "Delete" option at the top, and proceed with the deletion.
Step2: If the above step will not resolve the issue, it may be due to lack of permission to read the "MC" managed resource groups. To resolve this, grant the "Microsoft.SCOM" resource provider "Reader" permission on each “MC” resource group, or alternatively, at the subscription level, and then test the deletion again.
At Resource Group level:
- Go to Azure Portal → Resource Groups.
- Select the correct "MC" resource group.
- Navigate to Access Control (IAM).
- Click Add role assignment.
- In the Role tab, select Reader.
- In the Members tab:
- Select User, Group, or Service Principal
- +Select members search for "Microsoft.SCOM" and click on Select
- Click Next and then Review + Assign.
At Subscription Level:
- Go to Azure Portal → Subscriptions.
- Select your subscription
- Navigate to Access Control (IAM).
- Click Add role assignment.
- In the Role tab, select Reader.
- In the Members tab:
- Select User, Group, or Service Principal
- +Select members search for "Microsoft.SCOM" and click on Select
- Click Next and then Review + Assign.
Step3: If the above step will not resolve the issue, it may be due to lack of permission to delete the "MC" managed resource groups. To resolve this, follow the steps below to grant the necessary permission. Then try to delete the corresponding SCOM MI instance.
- Go to Azure Role Definitions:
- Navigate to Subscriptions in Azure Portal.
- Select your subscription.
- Click Access Control (IAM) → Roles.
- Click + Add → Add a custom role.
- Define the Custom Role:
- Give it a name (e.g., SCOM MI Deletion).
- Under Permissions, click + Add permissions.
- Search for Microsoft.Resources/subscriptions/resourceGroups/delete and select it.
- Click Next.
- Assign Custom Role to Microsoft.SCOM:
- Go to the "MC" managed Resource Group.
- Under Access Control (IAM) → Add role assignment.
- Select the new custom role (SCOM MI Deletion)
- Assign it to Microsoft.SCOM Step1:
Use the following action plan to delete the orphaned SCOM managed instances:- Create a new empty resource group with the name "MC_<SCOM_MI_ResourceGroup_Name>_<SCOM_MI_Instance_Name>" for example "MC_ManagedInstances_scomlpatj"
- Navigate to the orphaned SCOM managed instance, select the "Delete" option at the top, and proceed with the deletion.
If the above step will not resolve the issue, it may be due to lack of permission to read the "MC" managed resource groups.
To resolve this, grant the "Microsoft.SCOM" resource provider "Reader" permission on each “MC” resource group, or alternatively, at the subscription level, and then test the deletion again. At Resource Group level:- Go to Azure Portal → Resource Groups.
- Select the correct "MC" resource group.
- Navigate to Access Control (IAM).
- Click Add role assignment.
- In the Role tab, select Reader.
- In the Members tab:
- Select User, Group, or Service Principal
- +Select members search for "Microsoft.SCOM" and click on Select
- Click Next and then Review + Assign.
- Go to Azure Portal → Subscriptions.
- Select your subscription
- Navigate to Access Control (IAM).
- Click Add role assignment.
- In the Role tab, select Reader.
- In the Members tab:
- Select User, Group, or Service Principal
- +Select members search for "Microsoft.SCOM" and click on Select
- Click Next and then Review + Assign.
If the above step will not resolve the issue, it may be due to lack of permission to delete the "MC" managed resource groups.
To resolve this, follow the steps below to grant the necessary permission. Then try to delete the corresponding SCOM MI instance.- Go to Azure Role Definitions:
- Navigate to Subscriptions in Azure Portal.
- Select your subscription.
- Click Access Control (IAM) → Roles.
- Click + Add → Add a custom role.
- Define the Custom Role:
- Give it a name (e.g., SCOM MI Deletion).
- Under Permissions, click + Add permissions.
- Search for Microsoft.Resources/subscriptions/resourceGroups/delete and select it.
- Click Next.
- Assign Custom Role to Microsoft.SCOM:
- Go to the "MC" managed Resource Group.
- Under Access Control (IAM) → Add role assignment.
- Select the new custom role (SCOM MI Deletion)
- Assign it to Microsoft.SCOM
Hope this helps. Let us know how it goes!
If the response helped, do "Accept Answer" and up-vote it