Set-AzureRmDiagnosticSetting:异常类型:CloudException,消息:不支持指标类别 'AllMetrics'
Set-AzureRmDiagnosticSetting : Exception type: CloudException, Message: Metric category 'AllMetrics' is not supported
我遇到以下异常:
Exception type: CloudException, Message: Metric category 'AllMetrics'
is not supported.
运行 Azure PowerShell 命令 Set-AzureRmDiagnosticSetting
适用于任何 存储帐户 ,相同的命令也适用于其他资源类型,如 Key Vault、服务总线、负载均衡器等
Azure PowerShell 命令:
Set-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
,仍然出现相同的异常。
Metric category 'AllMetrics' is not supported.
根据错误消息,AllMetrics 不支持 Azure 存储帐户。
要启用 存储帐户 的指标,您可以使用 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.
我遇到以下异常:
Exception type: CloudException, Message: Metric category 'AllMetrics' is not supported.
运行 Azure PowerShell 命令 Set-AzureRmDiagnosticSetting
适用于任何 存储帐户 ,相同的命令也适用于其他资源类型,如 Key Vault、服务总线、负载均衡器等
Azure PowerShell 命令:
Set-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
,仍然出现相同的异常。
Metric category 'AllMetrics' is not supported.
根据错误消息,AllMetrics 不支持 Azure 存储帐户。
要启用 存储帐户 的指标,您可以使用 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