Getting the following error when trying to create ...
# azure
m
Getting the following error when trying to create a new Metric Alert (https://www.pulumi.com/registry/packages/azure-native/api-docs/insights/metricalert/):
Copy code
status code 400, {"error":{"code":"InvalidApiVersionParameter","message":"The api-version '2018-03-01' is invalid. The supported versions are '2022-11-01-preview,2022-09-01,2022-06-01,2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'."}}
Preview works fine. I have been able to create an ActivityLogAlert just fine, although the docs indicate that’s on a different API version. Any clues would be much appreciated. Using the following versions: Pulumi
3.52.1
AzCli
2.44.1
m
Hi Tim, Could you try to set the ApiVersion on the resource?
m
Hi Engin, Have tried with
Copy code
using MetricAlert = Pulumi.AzureNative.Insights.V20180301.MetricAlert;
using MetricAlertActionArgs = Pulumi.AzureNative.Insights.V20180301.Inputs.MetricAlertActionArgs;
and without, no luck unfortunately
m
I tired it too, ofc I have no real data, but it tries to create the resource:
Copy code
+   └─ azure-native:insights/v20180301:MetricAlert     metricAlert   **creating failed**             1 error


Diagnostics:
  pulumi:pulumi:Stack (ts-stuff-dev):
    error: update failed

  azure-native:insights/v20180301:MetricAlert (metricAlert):
    error: autorest/azure: Service returned an error. Status=403 Code="MultipleErrorsOccurred" Message="Multiple error occurred: Forbidden,Forbidden. Please see details." Details=[{"code":"LinkedAuthorizationFailed","message":"The client has permission to perform action 'microsoft.insights/webtests/read' on scope '/subscriptions/d62eb9ef-fe7c-45f5-8bd6-7b2b727869c4/resourceGroups/rg-example/providers/Microsoft.Insights/metricAlerts/webtest-name-example', however the linked subscription '12345678-1234-1234-1234-123456789101' was not found. "},{"code":"LinkedAuthorizationFailed","message":"The client has permission to perform action 'microsoft.insights/components/read' on scope '/subscriptions/d62eb9ef-fe7c-45f5-8bd6-7b2b727869c4/resourceGroups/rg-example/providers/Microsoft.Insights/metricAlerts/webtest-name-example', however the linked subscription '12345678-1234-1234-1234-123456789101' was not found. "}]

Resources:
    + 2 created
Can you maybe update the nugget packge of the azure-native provider to the latest
1.92.0
m
Tried with latest nugets but no luck, will need to park it for now and try again in a clean env next week
m
I will give it after my meeting a spin too in c#!
My code from above was ts
m
For ref my code is:
Copy code
new Pulumi.AzureNative.Insights.V20180301.MetricAlert("seq-traffic-alert", new()
        {
            Description = "Network traffic below threshold - instance possibly inaccessible",
            Enabled = true,
            Location = "Global",
            ResourceGroupName = resourceGroup.Id,
            Scopes = new[]
            {
                containerInstanceId
            },
        
            Actions = new[]
            {
                new Pulumi.AzureNative.Insights.V20180301.Inputs.MetricAlertActionArgs
                {
                    ActionGroupId = actionGroup.Id
                },
            },
            AutoMitigate = true,
            Severity = 1,
            EvaluationFrequency = "PT5M",
            WindowSize = "PT5M",
            Criteria = new Pulumi.AzureNative.Insights.V20180301.Inputs.MetricAlertSingleResourceMultipleMetricCriteriaArgs()
            {
                AllOf = new[]
                {
                    new Pulumi.AzureNative.Insights.V20180301.Inputs.MetricCriteriaArgs
                    {
                        Name = "networktraffic",
                        Threshold = 250,
                        MetricName = "NetworkBytesReceivedPerSecond",
                        MetricNamespace = "Microsoft.ContainerInstance/containerGroups",
                        Operator = "lessthan",
                        TimeAggregation = "Average",
        
                        CriterionType = "StaticThresholdCriterion",
                    },
                },
                OdataType = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria",
            },
        });
m
Ok, i can reproduce it in c#
I will create an issue for it, thanks for bringing this up
Hi @microscopic-furniture-52860, Can you change
ResourceGroupName = resourceGroup.Id
to
ResourceGroupName = resourceGroup.Name
please! Then it should work!
m
Doh, will give that a try later today! Thanks
362 Views