【问题标题】:Set-AzureRmDiagnosticSetting : Exception type: CloudException, Message: Metric category 'AllMetrics' is not supportedSet-AzureRmDiagnosticSetting:异常类型:CloudException,消息:不支持度量类别“AllMetrics”
【发布时间】:2018-11-01 04:00:28
【问题描述】:

我遇到了以下异常:

异常类型:CloudException,消息:指标类别“AllMetrics” 不支持。

为任何 存储帐户 运行 Azure PowerShell 命令 Set-AzureRmDiagnosticSetting,相同的命令适用于其他资源类型,如 Key VaultService Bus负载均衡器

Azure PowerShell 命令:

设置-AzureRmDiagnosticSetting -ResourceId $ResourceId -Enable $true -RetentionInDays 365 -RetentionEnabled $true

异常详情:

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

截图

还尝试使用不同的存储帐户资源 ID 指定参数 -StorageAccountId $StorageAccountIdLogs,仍然得到相同的异常。

【问题讨论】:

    标签: azure azure-storage azure-powershell


    【解决方案1】:

    不支持度量类别“AllMetrics”。

    根据错误消息,Azure 存储帐户 不支持 AllMetrics

    要启用存储帐户的指标,您可以使用Set-AzureStorageServiceMetricsProperty

    您可以参考我的示例命令,它在我这边运行良好。

    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
    

    更多详情请参考article

    【讨论】:

    • 不幸的是,这对我不起作用,即使在运行 Set-AzureStorageServiceMetricsProperty 命令后,我仍然得到相同的 'AllMetrics' is not supported exception running Set-AzureRmDiagnosticSetting,旁边是
    • 我说的是Set-AzureRmDiagnosticSetting 命令,而不是Set-AzureStorageServiceMetricsPropert
    • @rajeshmag 我认为Set-AzureRmDiagnosticSetting 不支持存储帐户,创建新存储帐户时默认启用存储指标,存储指标可用于 Blob、队列、表和文件服务.
    • 感谢 @Joy,存储帐户尚不支持 Azure 资源级诊断日志。关于supported services, schemas and categories for Azure Diagnostic Logs的可用列表的文章
    猜你喜欢
    • 2017-12-02
    • 1970-01-01
    • 2018-10-29
    • 1970-01-01
    • 1970-01-01
    • 2014-10-13
    • 2020-07-21
    • 2021-11-21
    • 2020-07-27
    相关资源
    最近更新 更多