Azure Monitor Baseline Alerts
Download AlertsGlossaryGitHubGitHub IssuesToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

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.

Cleanup Script Execution

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.

Download the Script File

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.

  1. Navigate to the AMBA project on GitHub.
  2. Browse to the patterns/alz/scripts directory.
  3. Locate and open the Start-ALZMonitorCleanup.ps1 script file.
  4. Click on the Raw button to view the raw content of the script.
  5. Save the file as Start-ALZMonitorCleanup.ps1.

Executing the Script

  1. Launch PowerShell.
  2. Install the Az.ResourceGraph module by running: Install-Module Az.ResourceGraph.
  3. Navigate to the directory containing the Start-ALZMonitorCleanup.ps1 script.
  4. 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.
  5. 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

Next Steps