1
votes

I am getting below exception:

Exception type: CloudException, Message: Metric category 'AllMetrics' is not supported.

Running Azure PowerShell command Set-AzureRmDiagnosticSetting for any Storage Account, same command works fine other resource type like Key Vault, Service Bus, Load Balancers etc.

Azure PowerShell command:

Set-AzureRmDiagnosticSetting -ResourceId $ResourceId -Enable $true -RetentionInDays 365 -RetentionEnabled $true

Exception details:

Set-AzureRmDiagnosticSetting : Exception type: CloudException, Message: Metric category 'AllMetrics' is not
supported., Code: BadRequest, Status code:BadRequest, Reason phrase: Bad Request
At line:1 char:1
+ Set-AzureRmDiagnosticSetting -ResourceId '/subscriptions/c1ddf901-1db ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzureRmDiagnosticSetting], PSInvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Insights.Diagnostics.SetAzureRmDiagnosticSettingCommand

Screenshot

enter image description here

Also tried specifying parameter -StorageAccountId $StorageAccountIdLogs with different Storage Account resource ID, still getting same exception.

1

1 Answers

0
votes

Metric category 'AllMetrics' is not supported.

According to the error message, AllMetrics is not supported to Azure Storage Account.

To enable metrics of Storage Account, you could use Set-AzureStorageServiceMetricsProperty.

You could refer to my sample command, it works fine on my side.

C:\PS>$Context = New-AzureStorageContext -StorageAccountName <StorageAccountName > -StorageAccountKey <StorageAccountKey >
C:\PS>Set-AzureStorageServiceMetricsProperty -ServiceType Blob -MetricsType Hour -MetricsLevel Service -Pass Thru -RetentionDays 10 -Version 1.0 -Context $Context

enter image description here For more details, refer to this article.