Im trying to create a `MetricAlert`that is connect...
# azure
f
Im trying to create a `MetricAlert`that is connected to a
WebTest
- according to https://docs.microsoft.com/en-us/rest/api/monitor/metricalerts/createorupdate#create-or-update-a-web-test-alert-rule it looks like it doesn't need a
scopes
-property, but Pulumi requires that
Scopes
is not empty. Settings scopes to ApplicationInsightsId failes with:
Copy code
Alert scope is invalid
Not settings Scopes failes with:
Copy code
Pulumi.Azure.Monitoring.MetricAlertArgs._scopes is required but was not given a value (Parameter '_scopes')
Any ideas? Sample code in thread.
Copy code
var insightsId = "<id to azure resource>";
var testname = "mywebtestalert";
var webtest = new WebTest(...);
_ = new MetricAlert(testname, new MetricAlertArgs()
{
    ResourceGroupName = ResourceGroupName,
    Name = testname,
    Scopes =
    {
        insightsId
    },
    Description = $"Use {testname} to monitor {name}",
    ApplicationInsightsWebTestLocationAvailabilityCriteria =
        new MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs()
        {
            ComponentId = insightsId,
            FailedLocationCount = 2,
            WebTestId = webtest.Id,
        }
});
b
is it just that you've used {} instead of [] for scopes?
looks like it takes an array of strings not an object
oh sorry i'm thinking of typescript 😄
😀 1