Decommission Azure Resources
Decommissioning an Azure resource is a two-phase process:
- Remove Guardrails-managed infrastructure from the Azure environment (event handlers, event pollers, permissions, resource groups).
- Disconnect the resource from the Guardrails workspace, removing all CMDB records and policy settings.
Guardrails natively allows an administrator to remove Azure resources (tenants, management groups, subscriptions) from a workspace. The delete action removes any associated policies and references in the database, but no resources are deleted from the target Azure environment. Careful consideration must be made when removing cloud resources, as once data is deleted (such as Action Groups and Activity Log Alerts), it cannot be retrieved.
Prerequisites
Turbot/Ownerpermissions at the Turbot resource level.
Phase 1: Decommission Guardrails Infrastructure
Before deleting the resource, set the following policies at the target resource level (tenant, management group, or subscription) to clean up Guardrails-managed resources. If you want to retain a particular resource (e.g., event handlers for compliance), skip that policy setting.
Allow time for Guardrails to complete each removal before proceeding to Phase 2.
| # | Policy | Value | What It Removes |
|---|---|---|---|
| 1 | Azure > Turbot > Permissions | Enforce: None | Guardrails-managed IAM policies, roles, and users. |
| 2 | Azure > Turbot > Resource Group | Enforce: Not configured | The Guardrails-configured resource group (turbot_rg). |
| 3 | Azure > Turbot > Event Handlers | Enforce: Not configured | Guardrails-created Action Groups and Activity Log Alerts. |
| 4 | Azure > Turbot > Event Poller | Disabled | Stops subscription-level event polling into Guardrails. |
| 5 | Azure > Turbot > Management Group Event Poller | Disabled | Stops management group hierarchy change detection. |
| 6 | Azure > Turbot > Directory Event Poller | Disabled | Stops Entra ID directory event polling. |
Any combination of these policies can be used to target specific resources while leaving important audit logging data available.
Phase 2: Disconnect the Resource
Once the controls associated with the above policies have completed:
-
Delete the credential policy settings configured on the target resource:
Azure > Client ID,Azure > Client Key,Azure > Environment, andAzure > Tenant ID. -
Navigate to the resource (tenant, subscription, or management group) in the Guardrails console.
-
On the Settings tab, scroll to the Danger Zone section. Click Delete.

-
In the confirmation dialog, copy the resource ID and paste it in the text box.
-
Click Delete. While this is not irreversible (you can reimport the resource), it can be time and resource consuming. Be sure to double and triple check.
Guardrails begins the delete process. The time to complete depends on the number of resources and policies that will be removed. The more resources being deleted, the longer the process takes.
[!NOTE] Disconnecting a resource does not modify anything in the Azure environment itself. It only removes the records from Guardrails.
Troubleshooting
| Issue | Solution |
|---|---|
| Delete fails with a referential integrity error | The delete function is a complex SQL transaction. Failures in referential integrity or other blocking/locking database activity can cause the delete to fail. Ensure that all event handlers for that Azure resource have been removed so no new transactions are incoming, then try again. |
| Delete takes a long time | Large resources with many child objects take longer to process. Consider reducing the resource count by disabling CMDB policies for large resource types before retrying. |
| Repeated delete failures | If the deletion error persists for more than several hours after removing the event handlers, and you have verified that no Azure resource activity is taking place in the Activity tab, please open a support ticket. |