Remediate Policies
By default, the policies are set to deploy-if-not-exists. This configuration affects any new deployments. In a greenfield scenario, where new resources and subscriptions are deployed, the policies will automatically create the necessary alert rules, action groups, and alert processing rules.
In a brownfield scenario, the policies will report non-compliance for existing resources within their scope. To remediate these non-compliant resources, you need to initiate remediation. This can be done through the Azure portal on a policy-by-policy basis or by running the Start-AMBA-ALZ-Remediation.ps1 script located in the .\patterns\alz\scripts folder. This script will remediate all AMBA-ALZ policies in scope as defined by the management group prefix.
Warning
This script requires PowerShell 7.0 or higher, and the following PowerShell modules:
To use the script, follow these steps:
- Log in to Azure PowerShell with an account that has at least Resource Policy Contributor permissions at the pseudo-root management group level.
- Navigate to the root directory of the cloned repository.
- Set the necessary variables.
- Execute the remediation script.
Warning
To execute the PowerShell scripts provided in the ALZ pattern, you may need to temporarily modify the execution policy if it is not set to Unrestricted. Check the current execution policy by running the following command:
If the execution policy is not Unrestricted, change it to Unrestricted by running:
After executing your scripts, you can revert the execution policy to its original setting if needed.
For example, to remediate the Alerting-Management initiative assigned to the alz-platform-management Management Group, execute the following commands:
The script will output the results of the REST API calls, typically returning a status code 201. If the script encounters an error, review the error message and verify that the management group name and policy name are correct. Upon successful execution of the script, you should observe multiple remediation tasks initiated within the alz-platform-management management group.
For convenience, assuming that the management hierarchy is fully aligned with the Azure Landing Zones (ALZ) architecture, the following commands can be used to remediate all policies assigned as per the guidance provided in this repository:
To remediate a single policy definition instead of the entire policy initiative, use the remediation script with the specific policy reference ID available on the Policy Initiatives page. For example, to remediate the Deploy AMBA Notification Assets policy, execute the following command:
By default, the policies are set to deploy-if-not-exists. This configuration affects any new deployments. In a greenfield scenario, where new resources are added to a subscription, the policies will automatically create the necessary alert rules, action groups, and alert processing rules.
In a brownfield scenario, the policies will report non-compliance for existing resources within their scope. To remediate these non-compliant resources, you need to initiate remediation. This can be done through the Azure portal on a policy-by-policy basis or by running the Start-AMBA-ALZ-Remediation.ps1 script located in the .\patterns\alz\scripts folder. This script will remediate all AMBA-ALZ policies in scope as defined by the management group prefix.
Warning
This script requires PowerShell 7.0 or higher, and the following PowerShell modules:
To use the script, follow these steps:
- Log in to Azure PowerShell with an account that has at least Resource Policy Contributor permissions at the pseudo-root management group level.
- Navigate to the root directory of the cloned repository.
- Set the necessary variables.
- Execute the remediation script.
Warning
To execute the PowerShell scripts provided in the ALZ pattern, you may need to temporarily modify the execution policy if it is not set to Unrestricted. Check the current execution policy by running the following command:
If the execution policy is not Unrestricted, change it to Unrestricted by running:
After executing your scripts, you can revert the execution policy to its original setting if needed.
For example, to remediate the Alerting-Management initiative assigned to the alz-platform-management Management Group, execute the following commands:
The script will output the results of the REST API calls, typically returning a status code 201. If the script encounters an error, review the error message and verify that the management group name and policy name are correct. Upon successful execution of the script, you should observe multiple remediation tasks initiated within the alz-platform-management management group.
For convenience, assuming that the management hierarchy is fully aligned with the Azure Landing Zones (ALZ) architecture, the following commands can be used to remediate all policies assigned as per the guidance provided in this repository:
To remediate a single policy definition instead of the entire policy initiative, use the remediation script with the specific policy reference ID available on the Policy Initiatives page. For example, to remediate the Deploy AMBA Notification Assets policy, execute the following command: