Urwashi
Urwashi

Reputation: 1

How to list Diagnostic Settings Destination Details using Azure Cli

I am using following Azure CLI command to list the Diagnostic Settings for a storage account blob Service, but it's only listing the 'Logs' and 'Metrics' info. I also need 'Destination Details'. Please could someone guide how do I list the **Destination Details** for Diagnostic Settings using Azure CLI

{
  "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"

Azure Diagnostic Setting

az monitor diagnostic-settings show --resource '/subscriptions/<subscription>/resourceGroups/<RG name>/providers/Microsoft.Storage/storageAccounts/<storage account name>/blobServices/default' --name '<Diagnostic Settings name>'

Upvotes: 0

Views: 96

Answers (1)

RithwikBojja
RithwikBojja

Reputation: 11383

How to list Diagnostic Settings Destination Details using Azure Cli

My Diagnostic Setting:

enter image description here

You can use below Azure Cli Script to get the destination of the diagnostic setting:

$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

Output:

enter image description here

Upvotes: 0

Related Questions