我使用以下 Azure CLI 命令列出存储帐户 blob 服务的诊断设置,但它仅列出“日志”和“指标”信息。我还需要“目的地详细信息”。请有人指导我如何使用 Azure CLI 列出诊断设置的
**Destination Details**
{
"id": "/subscriptions/<>/resourcegroups/<>/providers/microsoft.storage/storageaccounts/<>/blobservices/default/providers/microsoft.insights/diagnosticSettings/<>",
"logs": [
{
"category": "StorageRead",
"enabled": true,
"retentionPolicy": {
"days": 0,
"enabled": false
}
},
{
"category": "StorageWrite",
"enabled": true,
"retentionPolicy": {
"days": 0,
"enabled": false
}
},
{
"category": "StorageDelete",
"enabled": true,
"retentionPolicy": {
"days": 0,
"enabled": false
}
}
],
"metrics": [
{
"category": "Capacity",
"enabled": false,
"retentionPolicy": {
"days": 0,
"enabled": false
}
},
{
"category": "Transaction",
"enabled": false,
"retentionPolicy": {
"days": 0,
"enabled": false
}
}
],
"name": "",
"resourceGroup": "",
"storageAccountId": "/subscriptions/<>/resourceGroups/<>/providers/Microsoft.Storage/storageAccounts/<>",
"type": "Microsoft.Insights/diagnosticSettings",
"workspaceId": "/subscriptions/<>/resourceGroups/<>/providers/Microsoft.OperationalInsights/workspaces/<>-ctlz-log-analytics-workspace"
az monitor diagnostic-settings show --resource '/subscriptions/<subscription>/resourceGroups/<RG name>/providers/Microsoft.Storage/storageAccounts/<storage account name>/blobServices/default' --name '<Diagnostic Settings name>'
如何使用 Azure Cli 列出诊断设置目标详细信息我的诊断设置:
您可以使用下面的 Azure Cli 脚本来获取诊断设置的目标:
$rith=az monitor diagnostic-settings show --resource '/subscriptions/13f616/resourceGroups/cloud-shell-storage-centralindia/providers/Microsoft.Storage/storageAccounts/csg100d0/blobServices/default' --name 'testdiag'| ConvertFrom-Json
$test=$rith.workspaceId
$dest = $test.Split("/")[-1]
$dest
输出: