az monitor trace-association

This command group is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Route distributed traces to an Azure Monitor workspace.

A trace association sends the traces of an Application Insights component, or of every component in a resource group or subscription, to an Azure Monitor workspace. Associations are additive: a component sends traces to the workspaces associated with it, its resource group and its subscription.

Commands

Name Description Type Status
az monitor trace-association create

Route the traces of a scope to an Azure Monitor workspace.

Core Preview
az monitor trace-association delete

Delete the association of a scope.

Core Preview
az monitor trace-association list

List the associations that apply to a scope, including those of its resource group and subscription.

Core Preview
az monitor trace-association show

Show the association configured at exactly this scope.

Core Preview

az monitor trace-association create

Preview

Command group 'monitor trace-association' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Route the traces of a scope to an Azure Monitor workspace.

Creates the association of the scope, or replaces its workspace. Associations of other scopes are unchanged. If the workspace has no trace container, one is created first. Replacing the workspace of a resource group or subscription asks for confirmation. You need write access on both the scope and the workspace.

az monitor trace-association create --azure-monitor-workspace
                                    --resource-uri
                                    [--acquire-policy-token]
                                    [--change-reference]
                                    [--trace-metrics {Disabled, Enabled}]
                                    [--trace-retention-days]
                                    [--yes]

Examples

Route the traces of an Application Insights component to an Azure Monitor workspace.

az monitor trace-association create --resource-uri /subscriptions/{subscriptionID}/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/MyAppInsights --azure-monitor-workspace /subscriptions/{subscriptionID}/resourceGroups/MyResourceGroup/providers/Microsoft.Monitor/accounts/MyWorkspace

Route the traces of every Application Insights component in a resource group, creating the trace container with 90 days retention if the workspace has none.

az monitor trace-association create --resource-uri /subscriptions/{subscriptionID}/resourceGroups/MyResourceGroup --azure-monitor-workspace /subscriptions/{subscriptionID}/resourceGroups/MyResourceGroup/providers/Microsoft.Monitor/accounts/MyWorkspace --trace-retention-days 90

Required Parameters

--azure-monitor-workspace -w

Resource ID of the Azure Monitor workspace that receives the traces.

--resource-uri

Resource ID of an Application Insights component, a resource group or a subscription.

Optional Parameters

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

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--trace-metrics

Trace-derived metrics if the workspace has no trace container yet. Default: Enabled.

Property Value
Accepted values: Disabled, Enabled
--trace-retention-days

Days to keep traces, from 4 to 730, if the workspace has no trace container yet. Default: 30.

--yes -y

Do not prompt for confirmation.

Property Value
Default value: False
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 trace-association delete

Preview

Command group 'monitor trace-association' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Delete the association of a scope.

Associations of other scopes, the Azure Monitor workspace and its trace container are unchanged. Deleting the association of a resource group or subscription asks for confirmation.

az monitor trace-association delete --resource-uri
                                    [--acquire-policy-token]
                                    [--change-reference]
                                    [--yes]

Examples

Delete the association of a subscription without a confirmation prompt.

az monitor trace-association delete --resource-uri /subscriptions/{subscriptionID} --yes

Required Parameters

--resource-uri

Resource ID of an Application Insights component, a resource group or a subscription.

Optional Parameters

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

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--yes -y

Do not prompt for confirmation.

Property Value
Default value: False
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 trace-association list

Preview

Command group 'monitor trace-association' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

List the associations that apply to a scope, including those of its resource group and subscription.

az monitor trace-association list --resource-uri

Examples

List the associations that apply to an Application Insights component.

az monitor trace-association list --resource-uri /subscriptions/{subscriptionID}/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/MyAppInsights

Required Parameters

--resource-uri

Resource ID of an Application Insights component, a resource group or a subscription.

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 trace-association show

Preview

Command group 'monitor trace-association' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Show the association configured at exactly this scope.

Associations inherited from a resource group or subscription are not shown. Use list to see them.

az monitor trace-association show --resource-uri

Examples

Show the association of a resource group.

az monitor trace-association show --resource-uri /subscriptions/{subscriptionID}/resourceGroups/MyResourceGroup

Required Parameters

--resource-uri

Resource ID of an Application Insights component, a resource group or a subscription.

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