Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Missing" version for Microsoft.Insights/metricAlerts in C'sharp #2205

Closed
dirien opened this issue Jan 27, 2023 · 2 comments
Closed

"Missing" version for Microsoft.Insights/metricAlerts in C'sharp #2205

dirien opened this issue Jan 27, 2023 · 2 comments
Labels
kind/bug Some behavior is incorrect or out of spec

Comments

@dirien
Copy link
Contributor

dirien commented Jan 27, 2023

What happened?

When trying to create a Microsoft.Insights/metricAlerts in C#Sharp, we get following error message displayed:

azure-native:insights/v20180301:MetricAlert (seq-traffic-alert):
    error: cannot check existence of resource '/subscriptions/d62eb9ef-fe7c-45f5-8bd6-7b2b727869c4/resourceGroups/%2Fsubscriptions%2Fd62eb9ef-fe7c-45f5-8bd6-7b2b727869c4%2FresourceGroups%2FresourceGroupf745ba61/providers/Microsoft.Insights/metricAlerts/seq-traffic-alert2ee77ff6': status code 400, {"error":{"code":"InvalidApiVersionParameter","message":"The api-version '2018-03-01' is invalid. The supported versions are '2022-12-01,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'."}}

This does not happen in other languages (tested in typescript)

Expected Behavior

Creates the alert

Steps to reproduce

Here is the example code:

using Pulumi;
using Pulumi.AzureNative.Resources;
using Pulumi.AzureNative.Resources.Inputs;
using Pulumi.AzureNative.Storage;
using Pulumi.AzureNative.Storage.Inputs;
using Pulumi.AzureNative.Web.V20220301;
using System.Collections.Generic;
using Pulumi.AzureNative.DBforPostgreSQL.V20221201;

return await Pulumi.Deployment.RunAsync(() =>
{
    // Create an Azure Resource Group
    var resourceGroup = new ResourceGroup("resourceGroup");

    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[]
            {
                "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.ContainerInstance/containerGroups/seq"
            },
        
            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",
            },
        });
    
});

Output of pulumi about

❯ pulumi about
running 'dotnet build -nologo .'
  Determining projects to restore...

  All projects are up-to-date for restore.

  azure-csharp -> /Users/dirien/trash-stacks/azure-csharp/bin/Debug/net7.0/azure-csharp.dll



Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.56

'dotnet build -nologo .' completed successfully
CLI          
Version      3.52.1
Go Version   go1.19.5
Go Compiler  gc

Plugins
NAME          VERSION
azure-native  1.92.0
dotnet        unknown

Host     
OS       darwin
Version  12.5
Arch     arm64

This project is written in dotnet: executable='/opt/homebrew/bin/dotnet' version='7.0.102'

Current Stack: dirien/azure-csharp/dev

TYPE                                  URN
pulumi:pulumi:Stack                   urn:pulumi:dev::azure-csharp::pulumi:pulumi:Stack::azure-csharp-dev
pulumi:providers:azure-native         urn:pulumi:dev::azure-csharp::pulumi:providers:azure-native::default_1_92_0
azure-native:resources:ResourceGroup  urn:pulumi:dev::azure-csharp::azure-native:resources:ResourceGroup::resourceGroup


Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/dirien
User           dirien
Organizations  dirien, ediri

Dependencies:
NAME                VERSION
Pulumi              3.52.1
Pulumi.AzureNative  1.92.0

Pulumi locates its logs in /var/folders/tv/ccfx977s0f3934vn0wcm5d7c0000gn/T/ by default
warning: A new version of Pulumi is available. To upgrade from version '3.52.1' to '3.53.1', run 
   $ brew upgrade pulumi
or visit https://pulumi.com/docs/reference/install/ for manual instructions and release notes.

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@dirien dirien added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Jan 27, 2023
@thomas11
Copy link
Contributor

Hi @dirien! Try changing, in line 20 or so, ResourceGroupName = resourceGroup.Id to ResourceGroupName = resourceGroup.Name.

See #1487. We might need to add a check for this.

@thomas11 thomas11 added awaiting-feedback and removed needs-triage Needs attention from the triage team labels Jan 30, 2023
@dirien
Copy link
Contributor Author

dirien commented Jan 31, 2023

Yepp @thomas11, that was the issue. Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

2 participants