Is there any way to check the existance of a Loganalytic rule by the alertrulename using Az commands or shell script. Looking for some solution where I can check whether the given alertrule name in Azuredevops pipeline runtime paramenter is existing in Azure , if existing skip and if not existing create the alert rule.
Asked
Active
Viewed 126 times
1 Answers
0
You can view all the log alerts in a resource group using the following command:
az monitor scheduled-query list -g {ResourceGroup}
For more info please refer Manage log alerts using CLI.

Miao Tian-MSFT
- 571
- 4
- 5
-
but how can verify if a partucular alertrule is existing and capture the output, and do the creation only if its not present. – Vowneee Mar 02 '22 at 09:51
-
This is all monitor related Azure CLI commands for your reference:https://learn.microsoft.com/en-us/cli/azure/monitor?view=azure-cli-latest How did you get the alertrule name in Azure devops pipeline runtime paramenter? you can list the existing alert names and create a new one if it doesn't exist after comparing. (maybe using if... else... ). – Miao Tian-MSFT Mar 03 '22 at 03:47