To protect your shared platform resource groups and resources across multiple Azure subscriptions while allowing controlled updates by the platform team, you can implement the following Azure governance best practices:
- Management Locks: Use Azure management locks to prevent deletion or modification of the platform resource groups and resources. You can apply locks at the resource group level with the
CanNotDeletelock type to ensure that application teams cannot modify or delete these resources. This can be done using Azure PowerShell or Azure CLI commands as outlined in the Azure documentation. - Role-Based Access Control (RBAC): Implement RBAC to restrict access to the platform resource groups. Assign the application teams roles that allow them to manage their own workloads but do not grant them permissions to modify or delete the common platform resource groups. For example, you can assign the
Readerrole to application teams for the platform resource groups while giving the platform team the necessary permissions to manage these resources. - Azure Policy: Use Azure Policy to enforce compliance and ensure that only the platform team can make changes to the designated resource groups. You can create policies that audit or deny any unauthorized changes to these resources, providing an additional layer of governance.
- Automation for Temporary Unlocking: To avoid deployment issues with Terraform, establish a clear process for temporarily unlocking the resources during updates. You can automate this process using Azure Functions or Azure Automation. Create scripts that will:
- Remove the management lock before a deployment.
- Execute the Terraform deployment.
- Reapply the management lock after the deployment is complete.
- Terraform Patterns: Implement Terraform patterns that include pre- and post-deployment hooks to manage the locking and unlocking of resources. This can be achieved by using Terraform's
null_resourcewith provisioners to execute the unlocking and locking scripts as part of the deployment workflow.
By combining these approaches, you can effectively manage and protect your shared platform resources while allowing the platform team to perform necessary updates without encountering deployment failures due to locked resources.
References: