Moving Monitor alerts from one AppInsights to another with Azure CLI

Problem: When moving application insights from one location to another, monitor alerts are not moved by default. There is not feature in Microsoft Azure to migrate alerts from one App Insights to another.

Solution: Azure CLI

Below are the steps you need to perform:

Get the Name and Resource Group of the alert you want to move.

Run the following command to get the scope of the current alert:

az monitor metrics alert show --name ALERT_NAME --resource-group RESOURCE_GROUP_NAME

Create the new SCOPE by replacing old app insights name with the new one and run the following command to update the scope of the alert to new app insights resource:

az monitor metrics alert update --name ALERT_NAME  --resource-group RESOURCE_GROUP_NAME --scope NEW_SCOPE

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s