Azure scale set

Hi,

I am trying to add a custom autoscale setting for Machine Scale Set Azure but i am having the following error:

module.vmss_idotest-w.azurerm_monitor_autoscale_setting.auto: Modifying… [id=/…/providers/microsoft.insights/autoscalesettings/auto-scale-set-…-idotest-w]

Error: Error creating AutoScale Setting “auto-scale-set-…-idotest-w” (Resource Group “…”): insights.AutoscaleSettingsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 – Original Error: autorest/azure: Service returned an error. Status=400 Code=“UnsupportedMetric” Message=“Exception of type ‘Microsoft.WindowsAzure.Management.Monitoring.MonitoringServiceException’ was thrown.”

Is it possible to define “metric namespace” ?

Thanks,
Ido

Hi @idokaplan
Is there any code-snipped you could share?

Hi,

Is it enough?

    metric_trigger {
      metric_name        = "XXX"
      metric_resource_id = azurerm_windows_virtual_machine_scale_set.winsrv_vmss.id
      time_grain         = "PT1M"
      statistic          = "Average"
      time_window        = "PT5M"
      time_aggregation   = "Average"
      operator           = "GreaterThan"
      threshold          = 50 
    }

Thanks,
Ido

Are you looking for a custom metric instead of the predefined ones?

yes, i’m looking for a custom metric instead of the “XXX”

Hi,

Is there any update?
Thanks,
Ido

Hi @idokaplan,
IIRC there’s no option of a custom metric.
Is it available in ARM or azcli ?

Can you share the metric your trying to use? The code block you shown makes reference to Azures Microsoft.Insights registered provider. Here is a link of Azure supported metrics: Azure Monitor supported metrics by resource type - Azure Monitor. From what I can see it appears your tf module is going after resource azurerm_monitor_autoscale_setting

If possible can you get the entire block for the resource in this thread?

Additionally, have you run a TF_LOG = “trace”? You probably wont see much since its I don’t believe it to be a tf error. Statuscode 400 is typically just a indication of bad request call into the Azure ARM.

Happy to help let me know :slight_smile:

HI,

I’m trying to configure custom metric as I created based on this guide.

2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: HTTP/2.0 400 Bad Request
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: Content-Length: 144
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: Cache-Control: no-cache
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: Content-Type: application/json; charset=utf-8
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: Date: Fri, 22 Jan 2021 20:56:27 GMT
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: Expires: -1
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: Pragma: no-cache
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: Server: Microsoft-IIS/10.0
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: Strict-Transport-Security: max-age=31536000; includeSubDomains
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: X-Content-Type-Options: nosniff
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: X-Ms-Correlation-Request-Id: xxx
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: X-Ms-Ratelimit-Remaining-Subscription-Writes: xxx
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: X-Ms-Request-Id: xxx
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: X-Ms-Routing-Request-Id: FRANCESOUTH:xxx
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5:
2021-01-22T22:56:26.831+0200 [DEBUG] plugin.terraform-provider-azurerm_v2.0.0_x5: {“code”:“UnsupportedMetric”,“message”:“Exception of type ‘Microsoft.WindowsAzure.Management.Monitoring.MonitoringServiceException’ was thrown.”}
2021/01/22 22:56:26 [DEBUG] module.vmss_idotest-w.azurerm_monitor_autoscale_setting.auto: apply errored, but we’re indicating that via the Error pointer rather than returning it: Error creating AutoScale Setting "auto-scale-set-XXX insights.AutoscaleSettingsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 – Original Error: autorest/azure: Service returned an error. Status=400 Code=“UnsupportedMetric” Message=“Exception of type ‘Microsoft.WindowsAzure.Management.Monitoring.MonitoringServiceException’ was thrown.”