Skip to content

[BUG] Microsoft.Insights Autoscale rules metricName require an enum for valid values. #39072

@DanielMicrosoft

Description

@DanielMicrosoft

API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/autoscale_API.json

API Spec version

2022-10-01

Describe the bug

MetricTrigger.MetricName should be an enum with valid values instead of a primitive string type.

Expected behavior

This creates ambiguous errors in Azure-powershell which is generated from the spec of azure-rest-api-specs.

See issue: Azure/azure-powershell#24727

Actual behavior

See issue: Azure/azure-powershell#24727

User receives generic error for the metric name, with no guidance as to what are the accepted values.

Reproduction Steps

Api call to:

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroup}/providers/Microsoft.Insights/autoscalesettings/test-autoscale?api-version=2022-10-01

With payload:

{
  "properties": {
    "profiles": [{
      "rules": [{
        "metricTrigger": {
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.web/serverfarms",
          "metricResourceUri": "/subscriptions/.../providers/Microsoft.Web/serverfarms/test-asp"
        }
      }]
    }]
  }
}

Produces generic error:

Error: resource: /subscriptions/.../providers/Microsoft.Web/serverfarms/test-asp, 
       metricnamespace: microsoft.web/serverfarms, 
       metricname: Percentage CPU

Environment

Name Value


PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue requires a change to an existing behavior in the product in order to be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions