az monitor diagnostic-settings subscription

Manage diagnostic settings for subscription.

Commands

az monitor diagnostic-settings subscription create

Create diagnostic settings for a subscription.

az monitor diagnostic-settings subscription delete

Deletes existing subscription diagnostic settings for the specified resource.

az monitor diagnostic-settings subscription list

Gets the active subscription diagnostic settings list for the specified subscriptionId.

az monitor diagnostic-settings subscription show

Gets the active subscription diagnostic settings for the specified resource.

az monitor diagnostic-settings subscription update

Update diagnostic settings for a subscription.

az monitor diagnostic-settings subscription create

Create diagnostic settings for a subscription.

az monitor diagnostic-settings subscription create --location
                                                   --logs
                                                   --name
                                                   [--event-hub-auth-rule]
                                                   [--event-hub-name]
                                                   [--service-bus-rule]
                                                   [--storage-account]
                                                   [--subscription]
                                                   [--workspace]

Examples

Create diagnostic settings for a subscription with EventHub.

az monitor diagnostic-settings subscription create -n {name} --location westus --event-hub-auth-rule {eventHubRuleID} --storage-account {storageAccount} \
--logs '[
   {
     "category": "Security",
     "enabled": true,
   },
   {
     "category": "Administrative",
     "enabled": true,
   },
   {
     "category": "ServiceHealth",
     "enabled": true,
   },
   {
     "category": "Alert",
     "enabled": true,
   },
   {
     "category": "Recommendation",
     "enabled": true,
   },
   {
     "category": "Policy",
     "enabled": true,
   },
   {
     "category": "Autoscale",
     "enabled": true,
   },
   {
     "category": "ResourceHealth",
     "enabled": true,
   }
   ]'

Required Parameters

--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--logs

JSON encoded list of logs settings. Use '@{file}' to load from a file.

--name -n

The name of the diagnostic setting.

Optional Parameters

--event-hub-auth-rule

The resource Id for the event hub authorization rule.

--event-hub-name

The name of the event hub. If none is specified, the default event hub will be selected.

--service-bus-rule

The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format '{service bus resource ID}/authorizationrules/{key name}'.

--storage-account

The resource id of the storage account to which you would like to send the Activity Log.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--workspace

The resource id of the log analytics workspace.

az monitor diagnostic-settings subscription delete

Deletes existing subscription diagnostic settings for the specified resource.

az monitor diagnostic-settings subscription delete --name
                                                   [--subscription]
                                                   [--yes]

Required Parameters

--name -n

The name of the diagnostic setting.

Optional Parameters

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for confirmation.

az monitor diagnostic-settings subscription list

Gets the active subscription diagnostic settings list for the specified subscriptionId.

az monitor diagnostic-settings subscription list [--query-examples]
                                                 [--subscription]

Optional Parameters

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az monitor diagnostic-settings subscription show

Gets the active subscription diagnostic settings for the specified resource.

az monitor diagnostic-settings subscription show --name
                                                 [--query-examples]
                                                 [--subscription]

Required Parameters

--name -n

The name of the diagnostic setting.

Optional Parameters

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az monitor diagnostic-settings subscription update

Update diagnostic settings for a subscription.

az monitor diagnostic-settings subscription update --name
                                                   [--add]
                                                   [--event-hub-auth-rule]
                                                   [--event-hub-name]
                                                   [--force-string]
                                                   [--logs]
                                                   [--remove]
                                                   [--service-bus-rule]
                                                   [--set]
                                                   [--storage-account]
                                                   [--subscription]
                                                   [--workspace]

Required Parameters

--name -n

The name of the diagnostic setting.

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--event-hub-auth-rule

The resource Id for the event hub authorization rule.

--event-hub-name

The name of the event hub. If none is specified, the default event hub will be selected.

--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

--logs

JSON encoded list of logs settings. Use '@{file}' to load from a file.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--service-bus-rule

The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format '{service bus resource ID}/authorizationrules/{key name}'.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--storage-account

The resource id of the storage account to which you would like to send the Activity Log.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--workspace

The resource id of the log analytics workspace.