Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions src/azure-cli/azure/cli/command_modules/monitor/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,3 +625,59 @@
text: |
az monitor clone --source-resource /subscriptions/{subscriptionID}/resourceGroups/Space1999/providers/Microsoft.Compute/virtualMachines/vm1 --target-resource /subscriptions/{subscriptionID}/resourceGroups/Space1999/providers/Microsoft.Compute/virtualMachines/vm2
"""

helps['monitor trace-association'] = """
type: group
short-summary: Route distributed traces to an Azure Monitor workspace.
long-summary: >
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.
"""

helps['monitor trace-association create'] = """
type: command
short-summary: Route the traces of a scope to an Azure Monitor workspace.
long-summary: >
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.
examples:
- name: Route the traces of an Application Insights component to an Azure Monitor workspace.
text: |
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
- name: 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.
text: |
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
"""

helps['monitor trace-association show'] = """
type: command
short-summary: Show the association configured at exactly this scope.
long-summary: Associations inherited from a resource group or subscription are not shown. Use list to see them.
examples:
- name: Show the association of a resource group.
text: |
az monitor trace-association show --resource-uri /subscriptions/{subscriptionID}/resourceGroups/MyResourceGroup
"""

helps['monitor trace-association list'] = """
type: command
short-summary: List the associations that apply to a scope, including those of its resource group and subscription.
examples:
- name: List the associations that apply to an Application Insights component.
text: |
az monitor trace-association list --resource-uri /subscriptions/{subscriptionID}/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/MyAppInsights
"""

helps['monitor trace-association delete'] = """
type: command
short-summary: Delete the association of a scope.
long-summary: >
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.
examples:
- name: Delete the association of a subscription without a confirmation prompt.
text: |
az monitor trace-association delete --resource-uri /subscriptions/{subscriptionID} --yes
"""
16 changes: 16 additions & 0 deletions src/azure-cli/azure/cli/command_modules/monitor/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,19 @@ def load_arguments(self, _):
c.argument('monitor_types', options_list=['--types', '-t'], arg_type=get_enum_type(['metricsAlert']),
nargs='+', help='List of types of monitor settings which would be cloned.', default=['metricsAlert'])
# endregion

# region Trace Association
with self.argument_context('monitor trace-association') as c:
c.argument('resource_uri', options_list=['--resource-uri'],
help='Resource ID of an Application Insights component, a resource group or a subscription.')
c.argument('yes', options_list=['--yes', '-y'], action='store_true', help='Do not prompt for confirmation.')

with self.argument_context('monitor trace-association create') as c:
c.argument('azure_monitor_workspace', options_list=['--azure-monitor-workspace', '-w'],
help='Resource ID of the Azure Monitor workspace that receives the traces.')
c.argument('trace_retention_days', type=int,
help='Days to keep traces, from 4 to 730, if the workspace has no trace container yet. Default: 30.')
c.argument('trace_metrics', arg_type=get_enum_type(['Enabled', 'Disabled']),
help='Trace-derived metrics if the workspace has no trace container yet. '
'Default: Enabled.')
# endregion
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"monitor account trace-container",
is_preview=True,
)
class __CMDGroup(AAZCommandGroup):
"""Manage the trace container of an Azure Monitor workspace.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa
Loading
Loading