az monitor app-insights’ is misspelled or not recognized by the system.

By Micheal / June 28, 2022 Azure

trying to delete app insights using the Azure CLI

az monitor app-insight

But got this error

app-insights' is misspelled or not recognized by the system.

The solution is to install the app-insights extension first

az extension add -n application-insights

Now I can delete the app-insights resource on zure

az monitor app-insights component delete --app azfnv4 -g ms-learn

Notice that if you delete an Application Insights resource, the associated **Failure Anomalies alert rule **doesn’t get deleted automatically. you have to manually delete the alert rules with the following Azure CLI command:

az resource delete --ids <Resource ID>

for example:

az resource delete --ids "/subscriptions/00000-00000-0000-000/resourceGroups/ms-learn/providers/microsoft.alertsmanagement/smartDetectorAlertRules/Failure Anomalies - azfnv4"

You can get the id by listing all the resource in a resource group.

for example:

az resource list --resource-group ms-learn 
Tags: Az cli
← All Posts