Share via


az monitor diagnostic-settings

Manage service diagnostic settings.

Commands

Name Description Type Status
az monitor diagnostic-settings categories

Retrieve service diagnostic settings categories.

Core GA
az monitor diagnostic-settings categories list

List the diagnostic settings categories for the specified resource.

Core GA
az monitor diagnostic-settings categories show

Gets the diagnostic settings category for the specified resource.

Core GA
az monitor diagnostic-settings create

Create diagnostic settings for the specified resource. For more information, visit: https://learn.microsoft.com/rest/api/monitor/diagnosticsettings/createorupdate#metricsettings.

Core GA
az monitor diagnostic-settings delete

Deletes existing diagnostic settings for the specified resource.

Core GA
az monitor diagnostic-settings list

Gets the active diagnostic settings list for the specified resource.

Core GA
az monitor diagnostic-settings show

Gets the active diagnostic settings for the specified resource.

Core GA
az monitor diagnostic-settings subscription

Manage diagnostic settings for subscription.

Core GA
az monitor diagnostic-settings subscription create

Create subscription diagnostic settings for the specified resource.

Core GA
az monitor diagnostic-settings subscription delete

Deletes existing subscription diagnostic settings for the specified resource.

Core GA
az monitor diagnostic-settings subscription list

Gets the active subscription diagnostic settings list for the specified subscriptionId. :keyword callable cls: A custom type or function that will be passed the direct response:return: SubscriptionDiagnosticSettingsResourceCollection or the result of cls(response):rtype: ~$(python-base-namespace).v2017_05_01_preview.models.SubscriptionDiagnosticSettingsResourceCollection:raises ~azure.core.exceptions.HttpResponseError:.

Core GA
az monitor diagnostic-settings subscription show

Gets the active subscription diagnostic settings for the specified resource.

Core GA
az monitor diagnostic-settings subscription update

Update subscription diagnostic settings for the specified resource.

Core GA
az monitor diagnostic-settings update

Update diagnostic settings for the specified resource.

Core GA

az monitor diagnostic-settings create

Create diagnostic settings for the specified resource. For more information, visit: https://learn.microsoft.com/rest/api/monitor/diagnosticsettings/createorupdate#metricsettings.

az monitor diagnostic-settings create --name
                                      --resource
                                      [--event-hub]
                                      [--event-hub-rule]
                                      [--export-to-resource-specific {0, 1, f, false, n, no, t, true, y, yes}]
                                      [--logs]
                                      [--marketplace-partner-id]
                                      [--metrics]
                                      [--resource-group]
                                      [--resource-namespace]
                                      [--resource-parent]
                                      [--resource-type]
                                      [--storage-account]
                                      [--workspace]

Examples

Create diagnostic settings, retention here only applies when the target is a storage account.

az monitor diagnostic-settings create --resource {ID} -n {name} --storage-account {storageAccount} --logs "[{category:WorkflowRuntime,enabled:true,retention-policy:{enabled:false,days:0}}]" --metrics "[{category:WorkflowRuntime,enabled:true,retention-policy:{enabled:false,days:0}}]"

Required Parameters

--name -n

The name of the diagnostic setting. Required.

--resource

Name or ID of the target resource.

Property Value
Parameter group: Target Resource Arguments

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--event-hub

Name or ID an event hub. If none is specified, the default event hub will be selected.

--event-hub-rule

Name or ID of the event hub authorization rule.

--export-to-resource-specific

Indicate that the export to LA must be done to a resource specific table, a.k.a. dedicated or fixed schema table, as opposed to the default dynamic schema table called AzureDiagnostics. This argument is effective only when the argument --workspace is also given. Allowed values: false, true.

Property Value
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--logs

JSON encoded list of logs settings. Use '@{file}' to load from a file.For more information, visit: https://learn.microsoft.com/rest/api/monitor/diagnosticsettings/createorupdate#logsettings. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--marketplace-partner-id

The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs.

--metrics

The list of metric settings. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Property Value
Parameter group: Target Resource Arguments
--resource-namespace

Target resource provider namespace.

Property Value
Parameter group: Target Resource Arguments
--resource-parent

Target resource parent path, if applicable.

Property Value
Parameter group: Target Resource Arguments
--resource-type

Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines').

Property Value
Parameter group: Target Resource Arguments
--storage-account

Name or ID of the storage account to send diagnostic logs to.

--workspace

Name or ID of the Log Analytics workspace to send diagnostic logs to.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az monitor diagnostic-settings delete

Deletes existing diagnostic settings for the specified resource.

az monitor diagnostic-settings delete --name
                                      --resource
                                      [--resource-group]
                                      [--resource-namespace]
                                      [--resource-parent]
                                      [--resource-type]

Required Parameters

--name -n

The name of the diagnostic setting. Required.

--resource

Name or ID of the target resource.

Property Value
Parameter group: Target Resource Arguments

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Property Value
Parameter group: Target Resource Arguments
--resource-namespace

Target resource provider namespace.

Property Value
Parameter group: Target Resource Arguments
--resource-parent

Target resource parent path, if applicable.

Property Value
Parameter group: Target Resource Arguments
--resource-type

Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines').

Property Value
Parameter group: Target Resource Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az monitor diagnostic-settings list

Gets the active diagnostic settings list for the specified resource.

az monitor diagnostic-settings list --resource
                                    [--resource-group]
                                    [--resource-namespace]
                                    [--resource-parent]
                                    [--resource-type]

Required Parameters

--resource

Name or ID of the target resource.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--resource-namespace

Target resource provider namespace.

--resource-parent

Target resource parent path, if applicable.

--resource-type

Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines').

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az monitor diagnostic-settings show

Gets the active diagnostic settings for the specified resource.

az monitor diagnostic-settings show --name
                                    --resource
                                    [--resource-group]
                                    [--resource-namespace]
                                    [--resource-parent]
                                    [--resource-type]

Required Parameters

--name -n

The name of the diagnostic setting. Required.

--resource

Name or ID of the target resource.

Property Value
Parameter group: Target Resource Arguments

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Property Value
Parameter group: Target Resource Arguments
--resource-namespace

Target resource provider namespace.

Property Value
Parameter group: Target Resource Arguments
--resource-parent

Target resource parent path, if applicable.

Property Value
Parameter group: Target Resource Arguments
--resource-type

Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines').

Property Value
Parameter group: Target Resource Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az monitor diagnostic-settings update

Update diagnostic settings for the specified resource.

az monitor diagnostic-settings update --name
                                      --resource
                                      [--add]
                                      [--event-hub]
                                      [--event-hub-rule]
                                      [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                                      [--log-ana-dtype --log-analytics-destination-type]
                                      [--logs]
                                      [--marketplace-partner-id]
                                      [--metrics]
                                      [--remove]
                                      [--resource-group]
                                      [--resource-namespace]
                                      [--resource-parent]
                                      [--resource-type]
                                      [--service-bus-rule-id]
                                      [--set]
                                      [--storage-account-id]
                                      [--workspace-id]

Required Parameters

--name -n

The name of the diagnostic setting. Required.

--resource

Name or ID of the target resource.

Property Value
Parameter group: Target Resource Arguments

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--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>.

Property Value
Parameter group: Generic Update Arguments
--event-hub

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

Property Value
Parameter group: Properties Arguments
--event-hub-rule

The resource Id for the event hub authorization rule.

Property Value
Parameter group: Properties Arguments
--force-string

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

Property Value
Parameter group: Generic Update Arguments
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--log-ana-dtype --log-analytics-destination-type

A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: <normalized service identity>_<normalized category name>. Possible values are: Dedicated and null (null is default.).

Property Value
Parameter group: Properties Arguments
--logs

The list of logs settings. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Property Value
Parameter group: Properties Arguments
--marketplace-partner-id

The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs.

Property Value
Parameter group: Properties Arguments
--metrics

The list of metric settings. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Property Value
Parameter group: Properties Arguments
--remove

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

Property Value
Parameter group: Generic Update Arguments
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Property Value
Parameter group: Target Resource Arguments
--resource-namespace

Target resource provider namespace.

Property Value
Parameter group: Target Resource Arguments
--resource-parent

Target resource parent path, if applicable.

Property Value
Parameter group: Target Resource Arguments
--resource-type

Target resource type. Can also accept namespace/type format (Ex: 'Microsoft.Compute/virtualMachines').

Property Value
Parameter group: Target Resource Arguments
--service-bus-rule-id

The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.

Property Value
Parameter group: Properties Arguments
--set

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

Property Value
Parameter group: Generic Update Arguments
--storage-account-id

The resource ID of the storage account to which you would like to send Diagnostic Logs.

Property Value
Parameter group: Properties Arguments
--workspace-id

The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2.

Property Value
Parameter group: Properties Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False