Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.68k stars 5.1k forks source link

Microsoft.Insights/metricAlerts tag names are lowercased #16047

Closed aristosvo closed 3 years ago

aristosvo commented 3 years ago

Created metric alert gets lowercase tags keys instead of uppercase as submitted:

2021-09-15T12:28:04.218+0200 [DEBUG] provider.terraform-provider-azurerm_v2.74.0_x5: AzureRM Request: 
PUT /subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/Microsoft.Insights/metricAlerts/<alertname>?api-version=2018-03-01 HTTP/1.1
Host: management.azure.com
User-Agent: Go/go1.16.7 (amd64-darwin) go-autorest/v14.2.1 Azure-SDK-For-Go/v56.2.0 insights/2021-07-01-preview HashiCorp Terraform/1.0.5 (+https://www.terraform.io) Terraform Plugin SDK/2.7.0 terraform-provider-azurerm/2.74.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
Content-Length: 1238
Content-Type: application/json; charset=utf-8
X-Ms-Correlation-Request-Id: d1f4eac6-d2ac-2fb5-7395-67c5fac545ad
Accept-Encoding: gzip

{"location":"global","properties":{"actions":[{"actionGroupId":"/subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/microsoft.insights/actionGroups/<actionGroupName>","webHookProperties":{}}],"autoMitigate":false,"criteria":{"allOf":[{"criterionType":"StaticThresholdCriterion","dimensions":[],"metricName":"PipelineFailedRuns","metricNamespace":"Microsoft.DataFactory/factories","name":"Metric1","operator":"GreaterThan","skipMetricValidation":false,"threshold":0,"timeAggregation":"Total"}],"odata.type":"Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria"},"description":"<description>","enabled":false,"evaluationFrequency":"PT1H","scopes":["/subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/Microsoft.DataFactory/factories/<df-name>"],"severity":1,"targetResourceRegion":"westeurope","targetResourceType":"Microsoft.DataFactory/factories","windowSize":"PT1H"},"tags":{"Customer":"<customername>","Environment":"Test","Team":"Project"}}: timestamp=2021-09-15T12:28:04.217+0200
2021-09-15T12:28:05.537+0200 [DEBUG] provider.terraform-provider-azurerm_v2.74.0_x5: AzureRM Response for https://management.azure.com/subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/Microsoft.Insights/metricAlerts/<alertname>?api-version=2018-03-01: 
HTTP/2.0 200 OK
Api-Supported-Versions: 2017-09-01-preview, 2018-03-01
Arr-Disable-Session-Affinity: true
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Wed, 15 Sep 2021 10:28:04 GMT
Expires: -1
Pragma: no-cache
Server: Microsoft-IIS/10.0
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Accept-Encoding,Accept-Encoding
X-Aspnet-Version: 4.0.30319
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: d1f4eac6-d2ac-2fb5-7395-67c5fac545ad
X-Ms-Ratelimit-Remaining-Subscription-Resource-Requests: 299
X-Ms-Request-Id: df9fb55a-b081-4f93-ace6-21309a9a7117
X-Ms-Request-Id: df9fb55a-b081-4f93-ace6-21309a9a7117
X-Ms-Routing-Request-Id: WESTEUROPE:20210915T102805Z:df9fb55a-b081-4f93-ace6-21309a9a7117
X-Powered-By: ASP.NET

{
  "id": "/subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/Microsoft.Insights/metricAlerts/<alertname>",
  "name": "<alertname>",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "global",
  "tags": {
    "Customer": "<customername>",
    "Environment": "Test",
    "Team": "Project"
  },
  "properties": {
    "description": "<description>",
    "severity": 1,
    "enabled": false,
    "scopes": [
      "/subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/Microsoft.DataFactory/factories/<df-name>"
    ],
    "evaluationFrequency": "PT1H",
    "windowSize": "PT1H",
    "criteria": {
      "allOf": [
        {
          "threshold": 0.0,
          "name": "Metric1",
          "metricNamespace": "Microsoft.DataFactory/factories",
          "metricName": "PipelineFailedRuns",
          "operator": "GreaterThan",
          "timeAggregation": "Total",
          "skipMetricValidation": false,
          "criterionType": "StaticThresholdCriterion"
        }
      ],
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria"
    },
    "autoMitigate": false,
    "targetResourceType": "Microsoft.DataFactory/factories",
    "targetResourceRegion": "westeurope",
    "actions": [
      {
        "actionGroupId": "/subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/microsoft.insights/actionGroups/<actionGroupName>",
        "webHookProperties": {}
      }
    ]
  }
}: timestamp=2021-09-15T12:28:05.537+0200
2021-09-15T12:28:05.538+0200 [DEBUG] provider.terraform-provider-azurerm_v2.74.0_x5: Waiting for Monitor Metric Alert "<metricAlertName>" (Resource Group "<resourcegroup>") to be created: timestamp=2021-09-15T12:28:05.537+0200
2021-09-15T12:28:05.538+0200 [DEBUG] provider.terraform-provider-azurerm_v2.74.0_x5: Waiting for state to become: [200]: timestamp=2021-09-15T12:28:05.537+0200
2021-09-15T12:28:05.538+0200 [DEBUG] provider.terraform-provider-azurerm_v2.74.0_x5: AzureRM Request: 
GET /subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/Microsoft.Insights/metricAlerts/<metricAlertName>?api-version=2018-03-01 HTTP/1.1
Host: management.azure.com
User-Agent: Go/go1.16.7 (amd64-darwin) go-autorest/v14.2.1 Azure-SDK-For-Go/v56.2.0 insights/2021-07-01-preview HashiCorp Terraform/1.0.5 (+https://www.terraform.io) Terraform Plugin SDK/2.7.0 terraform-provider-azurerm/2.74.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
X-Ms-Correlation-Request-Id: d1f4eac6-d2ac-2fb5-7395-67c5fac545ad
Accept-Encoding: gzip: timestamp=2021-09-15T12:28:05.538+0200
2021-09-15T12:28:05.611+0200 [DEBUG] provider.terraform-provider-azurerm_v2.74.0_x5: AzureRM Response for https://management.azure.com/subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/Microsoft.Insights/metricAlerts/<metricAlertName>?api-version=2018-03-01: 
HTTP/2.0 200 OK
Api-Supported-Versions: 2017-09-01-preview, 2018-03-01
Arr-Disable-Session-Affinity: true
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Wed, 15 Sep 2021 10:28:04 GMT
Expires: -1
Pragma: no-cache
Server: Microsoft-IIS/10.0
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Accept-Encoding,Accept-Encoding
X-Aspnet-Version: 4.0.30319
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: d1f4eac6-d2ac-2fb5-7395-67c5fac545ad
X-Ms-Ratelimit-Remaining-Subscription-Reads: 11961
X-Ms-Request-Id: 80ed349d-7344-4cb1-a698-f104ca11e892
X-Ms-Request-Id: 80ed349d-7344-4cb1-a698-f104ca11e892
X-Ms-Routing-Request-Id: WESTEUROPE:20210915T102805Z:80ed349d-7344-4cb1-a698-f104ca11e892
X-Powered-By: ASP.NET

{
  "id": "/subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/Microsoft.Insights/metricAlerts/<metricAlertName>",
  "name": "<metricAlertName>",
  "type": "Microsoft.Insights/metricAlerts",
  "location": "global",
  "tags": {
    "customer": "<customername>",
    "environment": "Test",
    "team": "Project"
  },
  "properties": {
    "description": "<description>",
    "severity": 1,
    "enabled": false,
    "scopes": [
      "/subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/Microsoft.DataFactory/factories/<df-name>"
    ],
    "evaluationFrequency": "PT1H",
    "windowSize": "PT1H",
    "criteria": {
      "allOf": [
        {
          "threshold": 0.0,
          "name": "Metric1",
          "metricNamespace": "Microsoft.DataFactory/factories",
          "metricName": "PipelineFailedRuns",
          "operator": "GreaterThan",
          "timeAggregation": "Total",
          "skipMetricValidation": false,
          "criterionType": "StaticThresholdCriterion"
        }
      ],
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria"
    },
    "autoMitigate": false,
    "targetResourceType": "Microsoft.DataFactory/factories",
    "targetResourceRegion": "westeurope",
    "actions": [
      {
        "actionGroupId": "/subscriptions/<subscription>/resourceGroups/<resourcegroup>/providers/microsoft.insights/actionGroups/<actionGroupName>",
        "webHookProperties": {}
      }
    ]
  }
}: timestamp=2021-09-15T12:30:01.266+0200

Related

aristosvo commented 3 years ago

@ruowan Can you give us anything to assure this is in progress or anything? It's bugging my day to day an awful lot

ruowan commented 3 years ago

Sorry for delay response. I will try to triage this issue to service team.

tombuildsstuff commented 3 years ago

Looks like this is unique to API Version 2021-07-01-preview - so this appears to be an API Regression

SudoSpartanDan commented 3 years ago

Hi, I'm experiencing issues with this as well. @tombuildsstuff , our process is calling the API as follows, which is not using the 2021-07-01-preview API version.

PUT /subscriptions/XXX/resourceGroups/XXX/providers/Microsoft.Insights/metricAlerts/XXXXXX?api-version=2018-03-01

tgolly commented 3 years ago

@ruowan Can you give us anything to assure this is in progress or anything? It's bugging my day to day an awful lot

Agree this is a real problem, my Terraform is making a mess. Is there an ETA on resolution?

aristosvo commented 3 years ago

Hi, I'm experiencing issues with this as well. Our process is calling the API as follows, which is not using the 2021-07-01-preview API version.

PUT /subscriptions/XXX/resourceGroups/XXX/providers/Microsoft.Insights/metricAlerts/XXXXXX?api-version=2018-03-01

@SudoSpartanDan We share the same problem 🤜🏽 . As visible in the logs I posted:

There is a difference between SDK version and the actual API version used, confusing the whole thing a bit.

tgolly commented 3 years ago

The maintainers of the Terraform azurerm provider have noticed this issue and have a ticket open, there is a comment that confirms this is an upstream issue with the Azure API:

I tried to dig into the problem with a Microsoft support ticket and, from their testing, it seems like the newer version of the API causes this.

Hopefully Microsoft will revert this bug soon.

SudoSpartanDan commented 3 years ago

The maintainers of the Terraform azurerm provider have noticed this issue and have a ticket open, there is a comment that confirms this is an upstream issue with the Azure API:

I tried to dig into the problem with a Microsoft support ticket and, from their testing, it seems like the newer version of the API causes this.

Hopefully Microsoft will revert this bug soon.

Unfortunately, the ticket didn't go anywhere. :( I was told it was an issue on the Terraform side, which we can see here is not the case. Anyone else able to get some progress on this?

aristosvo commented 3 years ago

@ruowan There is still no-one assigned to this issue, can you take a quick look? I'd expect to see an assignment on a service team and/or some members.

Maybe it needs a different tag, like Monitor - ApplicationInsights / Monitor - LogAnalytics / Monitor - Operational Insights / Monitor - Metrics?

SudoSpartanDan commented 3 years ago

@ruowan This is affecting our ability to run proper reports on our resources. What do we need to do to escalate this issue? I submitted a Microsoft ticket, but it was closed because it was believed to be a Terraform issue. From our logs and the evidence presented by @aristosvo, though, this seems to be an issue with the API or the Azure SDK itself.

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azmonapplicationinsights.

Issue Details
Created metric alert gets lowercase tags keys instead of uppercase as submitted: ```bash 2021-09-15T12:28:04.218+0200 [DEBUG] provider.terraform-provider-azurerm_v2.74.0_x5: AzureRM Request: PUT /subscriptions//resourceGroups//providers/Microsoft.Insights/metricAlerts/?api-version=2018-03-01 HTTP/1.1 Host: management.azure.com User-Agent: Go/go1.16.7 (amd64-darwin) go-autorest/v14.2.1 Azure-SDK-For-Go/v56.2.0 insights/2021-07-01-preview HashiCorp Terraform/1.0.5 (+https://www.terraform.io) Terraform Plugin SDK/2.7.0 terraform-provider-azurerm/2.74.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820 Content-Length: 1238 Content-Type: application/json; charset=utf-8 X-Ms-Correlation-Request-Id: d1f4eac6-d2ac-2fb5-7395-67c5fac545ad Accept-Encoding: gzip {"location":"global","properties":{"actions":[{"actionGroupId":"/subscriptions//resourceGroups//providers/microsoft.insights/actionGroups/","webHookProperties":{}}],"autoMitigate":false,"criteria":{"allOf":[{"criterionType":"StaticThresholdCriterion","dimensions":[],"metricName":"PipelineFailedRuns","metricNamespace":"Microsoft.DataFactory/factories","name":"Metric1","operator":"GreaterThan","skipMetricValidation":false,"threshold":0,"timeAggregation":"Total"}],"odata.type":"Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria"},"description":"","enabled":false,"evaluationFrequency":"PT1H","scopes":["/subscriptions//resourceGroups//providers/Microsoft.DataFactory/factories/"],"severity":1,"targetResourceRegion":"westeurope","targetResourceType":"Microsoft.DataFactory/factories","windowSize":"PT1H"},"tags":{"Customer":"","Environment":"Test","Team":"Project"}}: timestamp=2021-09-15T12:28:04.217+0200 2021-09-15T12:28:05.537+0200 [DEBUG] provider.terraform-provider-azurerm_v2.74.0_x5: AzureRM Response for https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Insights/metricAlerts/?api-version=2018-03-01: HTTP/2.0 200 OK Api-Supported-Versions: 2017-09-01-preview, 2018-03-01 Arr-Disable-Session-Affinity: true Cache-Control: no-cache Content-Type: application/json; charset=utf-8 Date: Wed, 15 Sep 2021 10:28:04 GMT Expires: -1 Pragma: no-cache Server: Microsoft-IIS/10.0 Strict-Transport-Security: max-age=31536000; includeSubDomains Vary: Accept-Encoding,Accept-Encoding X-Aspnet-Version: 4.0.30319 X-Content-Type-Options: nosniff X-Ms-Correlation-Request-Id: d1f4eac6-d2ac-2fb5-7395-67c5fac545ad X-Ms-Ratelimit-Remaining-Subscription-Resource-Requests: 299 X-Ms-Request-Id: df9fb55a-b081-4f93-ace6-21309a9a7117 X-Ms-Request-Id: df9fb55a-b081-4f93-ace6-21309a9a7117 X-Ms-Routing-Request-Id: WESTEUROPE:20210915T102805Z:df9fb55a-b081-4f93-ace6-21309a9a7117 X-Powered-By: ASP.NET { "id": "/subscriptions//resourceGroups//providers/Microsoft.Insights/metricAlerts/", "name": "", "type": "Microsoft.Insights/metricAlerts", "location": "global", "tags": { "Customer": "", "Environment": "Test", "Team": "Project" }, "properties": { "description": "", "severity": 1, "enabled": false, "scopes": [ "/subscriptions//resourceGroups//providers/Microsoft.DataFactory/factories/" ], "evaluationFrequency": "PT1H", "windowSize": "PT1H", "criteria": { "allOf": [ { "threshold": 0.0, "name": "Metric1", "metricNamespace": "Microsoft.DataFactory/factories", "metricName": "PipelineFailedRuns", "operator": "GreaterThan", "timeAggregation": "Total", "skipMetricValidation": false, "criterionType": "StaticThresholdCriterion" } ], "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" }, "autoMitigate": false, "targetResourceType": "Microsoft.DataFactory/factories", "targetResourceRegion": "westeurope", "actions": [ { "actionGroupId": "/subscriptions//resourceGroups//providers/microsoft.insights/actionGroups/", "webHookProperties": {} } ] } }: timestamp=2021-09-15T12:28:05.537+0200 2021-09-15T12:28:05.538+0200 [DEBUG] provider.terraform-provider-azurerm_v2.74.0_x5: Waiting for Monitor Metric Alert "" (Resource Group "") to be created: timestamp=2021-09-15T12:28:05.537+0200 2021-09-15T12:28:05.538+0200 [DEBUG] provider.terraform-provider-azurerm_v2.74.0_x5: Waiting for state to become: [200]: timestamp=2021-09-15T12:28:05.537+0200 2021-09-15T12:28:05.538+0200 [DEBUG] provider.terraform-provider-azurerm_v2.74.0_x5: AzureRM Request: GET /subscriptions//resourceGroups//providers/Microsoft.Insights/metricAlerts/?api-version=2018-03-01 HTTP/1.1 Host: management.azure.com User-Agent: Go/go1.16.7 (amd64-darwin) go-autorest/v14.2.1 Azure-SDK-For-Go/v56.2.0 insights/2021-07-01-preview HashiCorp Terraform/1.0.5 (+https://www.terraform.io) Terraform Plugin SDK/2.7.0 terraform-provider-azurerm/2.74.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820 X-Ms-Correlation-Request-Id: d1f4eac6-d2ac-2fb5-7395-67c5fac545ad Accept-Encoding: gzip: timestamp=2021-09-15T12:28:05.538+0200 2021-09-15T12:28:05.611+0200 [DEBUG] provider.terraform-provider-azurerm_v2.74.0_x5: AzureRM Response for https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Insights/metricAlerts/?api-version=2018-03-01: HTTP/2.0 200 OK Api-Supported-Versions: 2017-09-01-preview, 2018-03-01 Arr-Disable-Session-Affinity: true Cache-Control: no-cache Content-Type: application/json; charset=utf-8 Date: Wed, 15 Sep 2021 10:28:04 GMT Expires: -1 Pragma: no-cache Server: Microsoft-IIS/10.0 Strict-Transport-Security: max-age=31536000; includeSubDomains Vary: Accept-Encoding,Accept-Encoding X-Aspnet-Version: 4.0.30319 X-Content-Type-Options: nosniff X-Ms-Correlation-Request-Id: d1f4eac6-d2ac-2fb5-7395-67c5fac545ad X-Ms-Ratelimit-Remaining-Subscription-Reads: 11961 X-Ms-Request-Id: 80ed349d-7344-4cb1-a698-f104ca11e892 X-Ms-Request-Id: 80ed349d-7344-4cb1-a698-f104ca11e892 X-Ms-Routing-Request-Id: WESTEUROPE:20210915T102805Z:80ed349d-7344-4cb1-a698-f104ca11e892 X-Powered-By: ASP.NET { "id": "/subscriptions//resourceGroups//providers/Microsoft.Insights/metricAlerts/", "name": "", "type": "Microsoft.Insights/metricAlerts", "location": "global", "tags": { "customer": "", "environment": "Test", "team": "Project" }, "properties": { "description": "", "severity": 1, "enabled": false, "scopes": [ "/subscriptions//resourceGroups//providers/Microsoft.DataFactory/factories/" ], "evaluationFrequency": "PT1H", "windowSize": "PT1H", "criteria": { "allOf": [ { "threshold": 0.0, "name": "Metric1", "metricNamespace": "Microsoft.DataFactory/factories", "metricName": "PipelineFailedRuns", "operator": "GreaterThan", "timeAggregation": "Total", "skipMetricValidation": false, "criterionType": "StaticThresholdCriterion" } ], "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" }, "autoMitigate": false, "targetResourceType": "Microsoft.DataFactory/factories", "targetResourceRegion": "westeurope", "actions": [ { "actionGroupId": "/subscriptions//resourceGroups//providers/microsoft.insights/actionGroups/", "webHookProperties": {} } ] } }: timestamp=2021-09-15T12:30:01.266+0200 ``` ## Related - [azurerm_monitor_metric_alert](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_metric_alert)
Author: aristosvo
Assignees: -
Labels: `question`, `Monitor - Operational Insights`, `Insights`, `Service Attention`, `customer-reported`, `Monitor - Metrics`, `Monitor - ApplicationInsights`
Milestone: -
ruowan commented 3 years ago

Sorry for inconveniency. I added monitor labels. Since I am not from monitor team. I am syncing with my manager to escalate this issue. Will respond soon.

ruowan commented 3 years ago

Hi, @yashmuel could you pls take a look at this issue?

yashmuel commented 3 years ago

hi, @aristosvo, I'm from Metric Alerts team. We had a bug in the backend, regarding lowercase tags. We've already fixed this, can you please try again and let me know if it still reproduced?

aristosvo commented 3 years ago

I'll try and let you know!

aristosvo commented 3 years ago

@yashmuel Thanks a lot, it seems fixed! If there is any better way to provide you this feedback in the future, I'm happy to hear it.

I'll introduce some extra tests for the azurerm Terraform provider to keep an eye on it and future regressions.