I use "az monitor scheduled-query" to create ALerting on Application Insight on Azure but it show me error message "ERROR: (BadRequest) Scope can not be updated"
. Please help me to fix this bug
I have run the command to create the alert rule in Application Insights for Azure VM with the below command:
az monitor scheduled-query create -g "HariTestRG" -n "testkvm01" --scopes "/subscriptions/<subs-id>/resourceGroups/<RGName>/providers/Microsoft.Compute/virtualMachines/testkvm01" --condition "count 'Placeholder_1' > 360 resource id _ResourceId at least 1 violations out of 5 aggregated points" --condition-query Placeholder_1="union Event, Syslog | where TimeGenerated > ago(1h) | where EventLevelName=='Error' or SeverityLevel=='err'" --description "Test rule"
Here vm_id is the resource id of the virtual machine.
Result:
In Portal View:
References: MSFT Doc of CLI command to create the Scheduled Alert
i got the same error and i got a better view of the error when i went to
Azure Portal > Resource Group > (see image below)
Activity Log
Create Deployment
Scheduled query rule write (The specific line that failed)
JSON
The cause of error for me was that an existing alert rule already exists for another Azure Data Factory. so i renamed the Alert Rule names and got it fixed.
2
Answers
I have run the command to create the alert rule in Application Insights for Azure VM with the below command:
Here vm_id is the resource id of the virtual machine.
Result:
In Portal View:
References: MSFT Doc of CLI command to create the Scheduled Alert
i got the same error and i got a better view of the error when i went to
Azure Portal > Resource Group > (see image below)
The cause of error for me was that an existing alert rule already exists for another Azure Data Factory. so i renamed the Alert Rule names and got it fixed.