Adding Azure SQL server metric alert via Bicep fails with "Couldn't find a metric named deadlock."

lmp 5 Reputation points
2024-12-30T14:09:07.49+00:00

I'm trying to deploy some metrics based alerts, using the sample code provided by the AMBA project. Most of the alerts work fine, but a number of them have the same issue, namely ""Couldn't find a metric named ####. Make sure the name is correct." where #### is the name of the metric

  • The metrics do exist
    • they are visible in Azure Monitor metric explorer
    • I can manually create the metrics alerts in the portal
    • the issue comes up only when deploying with Bicep
  • The resources that the alerts are related to already exist, so it shouldn't be a race condition
  • The metrics I have issues with are
    • dtu_limit (sql server)
    • deadlock (sql server)
    • connection_failed (sql server)
    • CpuUtilization (application gateway)
  • Some metrics that work without issue
    • dtu_used (sql server)
    • FailedRequests (application gateway)

Any tips?

Azure SQL Database
{count} votes

2 answers

Sort by: Most helpful
  1. lmp 5 Reputation points
    2025-01-14T15:49:01.5+00:00

    I looked at my parameters more closely and noticed I was accidentally providing the DB server resourceId as the targetResourceId instead of the DB resourceId. Fixing this solved the issue.

    1 person found this answer helpful.
    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.