title: Can't create an alert for an App Insights custom metric on Azure
body: <p>I'm trying to create an alert for an App Insights custom metric on Azure. </p>
  
  <p>e.g. alert if the "My Metric" metric is greater than 40 for 5 minutes. </p>
  
  <p>According to Custom metrics in Azure Monitor this should be possible.</p>
  
  <blockquote>
    <p>After they're published to Azure Monitor, you can browse, query, and alert on custom metrics for your Azure resources and applications side by side with the standard metrics emitted by Azure.</p>
  </blockquote>
  
  <p>I created the metric with this code using the App Insights Python SDK (see <a href="https://github.com/microsoft/ApplicationInsights-Python#usage" rel="nofollow noreferrer">Usage</a>).</p>
  
  <pre><code>from applicationinsights import TelemetryClient
  tc = TelemetryClient('&lt;YOUR INSTRUMENTATION KEY GOES HERE&gt;')
  tc.track_metric('My Metric', 42)
  tc.flush()
  </code></pre>
  
  <p>I can view the custom metric I created. It's the lone blue bar in the screenshot of the Metrics screen in the Azure portal.</p>
  
  <p><a href="https://i.stack.imgur.com/mkpbw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mkpbw.png" alt="Metrics"></a></p>
  
  <p>However, when I click on the New rule alert button on that screen, I'm taken to the Create rule screen but it displays the following error.</p>
  
  <blockquote>
    <p>Alerts configuration via Metrics not supported if selection includes multiple resources or more than two metric signals. Please modify your selection and try again or create the rule below. Please click to see the list of supported resources.</p>
  </blockquote>
  
  <p>AFAIK, I'm only using one resource (the App Insights "Dev" resource) and one metric signal (the "My Metric" metric) as you can see from the screenshot.</p>
  
  <p>Any ideas on what I've done wrong or what I'm missing and how I can correct it?</p>
  
  <p>I'm pretty new to Azure so I'm also open to suggestions on others way of alerting on a custom metric.</p>