Transitioning from Preview to General Availability (GA)
To transition from the preview version to the General Availability (GA) version of the ALZ Monitor solution, you must remove all previously deployed resources. Follow these instructions to execute a PowerShell script that deletes the following resources:
- Metric Alerts
- Activity Log Alerts
- Policy Assignments
- Policy Definitions
- Policy Set Definitions
- Policy Assignment remediation identity role assignments
- Action Groups
- Alert Processing Rules
All resources deployed by the ALZ Monitor solution, including those created dynamically by ‘deploy if not exist’ policies, are tagged or marked with _deployed_by_alz_monitor
or _deployed_by_alz_monitor=True
. This metadata is essential for the cleanup script to identify and remove the resources. If this metadata has been altered or removed, the script will not recognize those resources for deletion.
It is strongly recommended to thoroughly test the script in a non-production environment before deploying it to production. These sample scripts are not covered by any Microsoft standard support program or service. They are provided “AS IS” without any warranty, express or implied. Microsoft disclaims all implied warranties, including but not limited to, implied warranties of merchantability or fitness for a particular purpose. The user assumes all risks associated with the use or performance of the sample scripts and documentation. Microsoft, its authors, or any contributors to the creation, production, or delivery of the scripts shall not be liable for any damages, including but not limited to, loss of business profits, business interruption, loss of business information, or other financial losses, arising from the use or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
Follow these steps to download the cleanup script file. Alternatively, you can clone the repository from GitHub and ensure you have the latest version by fetching the main
branch.
- Navigate to the AMBA project on GitHub.
- Browse to the
patterns/alz/scripts
directory. - Locate and open the Start-ALZMonitorCleanup.ps1 script file.
- Click on the Raw button to view the raw content of the script.
- Save the file as Start-ALZMonitorCleanup.ps1.
- Launch PowerShell.
- Install the Az.ResourceGraph module by running:
Install-Module Az.ResourceGraph
. - Navigate to the directory containing the Start-ALZMonitorCleanup.ps1 script.
- Sign in to Azure using the
Connect-AzAccount
command. Ensure the account has the necessary permissions to remove Policy Assignments, Policy Definitions, and resources at the required Management Group scope. - Execute the script with one of the following options:
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:
Get-ExecutionPolicy
If the execution policy is not Unrestricted, change it to Unrestricted by running:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
After executing your scripts, you can revert the execution policy to its original setting if needed.
Generate a list of the resource IDs that would be deleted by this script:
./Start-ALZMonitorCleanup.ps1 -ReportOnly
Show output of what would happen if deletes were executed:
./Start-ALZMonitorCleanup.ps1 -WhatIf
Delete all resources deployed by the ALZ-Monitor IaC without prompting for confirmation:
./Start-ALZMonitorCleanup.ps1 -Force
- For customizing policy assignments, refer to Customize Policy Assignment.
- For deplyment using Azure Portal, refer to Deploy via the Azure Portal (Preview) (recommended method)
- For deployment using GitHub Actions, refer to Deploy with GitHub Actions.
- For deployment using Azure DevOps Pipelines, refer to Deploy with Azure Pipelines.
- For deployment using Azure CLI, refer to Deploy with Azure CLI.
- For deployment using Azure PowerShell, refer to Deploy with Azure PowerShell.