az monitor log-analytics workspace linked-service

Manage linked service for log analytics workspace.

Linked services is used to defined a relation from the workspace to another Azure resource. Log Analytics and Azure resources then leverage this connection in their operations. Example uses of Linked Services in Log Analytics workspace are Automation account and workspace association to CMK.

Commands

az monitor log-analytics workspace linked-service create

Create a linked service.

az monitor log-analytics workspace linked-service delete

Delete a linked service.

az monitor log-analytics workspace linked-service list

Gets all the linked services in a workspace.

az monitor log-analytics workspace linked-service show

Show the properties of a linked service.

az monitor log-analytics workspace linked-service update

Update a linked service.

az monitor log-analytics workspace linked-service wait

Place the CLI in a waiting state until a condition of the linked service is met.

az monitor log-analytics workspace linked-service create

Create a linked service.

az monitor log-analytics workspace linked-service create --name
                                                         --resource-group
                                                         --workspace-name
                                                         [--no-wait]
                                                         [--resource-id]
                                                         [--subscription]
                                                         [--write-access-resource-id]

Examples

Create a linked service.

az monitor log-analytics workspace linked-service create -g MyResourceGroup -n cluster \
  --workspace-name MyWorkspace --write-access-resource-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.OperationalInsights/clusters/MyCluster

Required Parameters

--name -n

Name of the linkedServices resource. Supported values: cluster, automation.

--resource-group -g

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

--workspace-name

Name of the Log Analytics Workspace.

Optional Parameters

--no-wait

Do not wait for the long-running operation to finish.

--resource-id

The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require read access.

--subscription

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

--write-access-resource-id

The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require write access.

az monitor log-analytics workspace linked-service delete

Delete a linked service.

az monitor log-analytics workspace linked-service delete --name
                                                         --resource-group
                                                         --workspace-name
                                                         [--no-wait]
                                                         [--subscription]
                                                         [--yes]

Examples

Delete a linked service.

az monitor log-analytics workspace linked-service delete -g MyResourceGroup -n cluster --workspace-name MyWorkspace

Required Parameters

--name -n

Name of the linkedServices resource. Supported values: cluster, automation.

--resource-group -g

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

--workspace-name

Name of the Log Analytics Workspace.

Optional Parameters

--no-wait

Do not wait for the long-running operation to finish.

--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 log-analytics workspace linked-service list

Gets all the linked services in a workspace.

az monitor log-analytics workspace linked-service list --resource-group
                                                       --workspace-name
                                                       [--query-examples]
                                                       [--subscription]

Examples

Gets all the linked services in a workspace.

az monitor log-analytics workspace linked-service list -g MyResourceGroup --workspace-name MyWorkspace

Required Parameters

--resource-group -g

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

--workspace-name

Name of the Log Analytics Workspace.

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 log-analytics workspace linked-service show

Show the properties of a linked service.

az monitor log-analytics workspace linked-service show --name
                                                       --resource-group
                                                       --workspace-name
                                                       [--query-examples]
                                                       [--subscription]

Examples

Show the properties of a linked service.

az monitor log-analytics workspace linked-service show -g MyResourceGroup -n cluster --workspace-name MyWorkspace

Required Parameters

--name -n

Name of the linkedServices resource. Supported values: cluster, automation.

--resource-group -g

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

--workspace-name

Name of the Log Analytics Workspace.

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 log-analytics workspace linked-service update

Update a linked service.

az monitor log-analytics workspace linked-service update --name
                                                         --resource-group
                                                         --workspace-name
                                                         [--add]
                                                         [--force-string]
                                                         [--no-wait]
                                                         [--remove]
                                                         [--resource-id]
                                                         [--set]
                                                         [--subscription]
                                                         [--write-access-resource-id]

Examples

Update a linked service.

az monitor log-analytics workspace linked-service update -g MyResourceGroup -n cluster \
  --workspace-name MyWorkspace --write-access-resource-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.OperationalInsights/clusters/MyCluster

Required Parameters

--name -n

Name of the linkedServices resource. Supported values: cluster, automation.

--resource-group -g

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

--workspace-name

Name of the Log Analytics Workspace.

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

--force-string

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

--no-wait

Do not wait for the long-running operation to finish.

--remove

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

--resource-id

The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require read access.

--set

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

--subscription

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

--write-access-resource-id

The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require write access.

az monitor log-analytics workspace linked-service wait

Place the CLI in a waiting state until a condition of the linked service is met.

az monitor log-analytics workspace linked-service wait --name
                                                       --resource-group
                                                       --workspace-name
                                                       [--created]
                                                       [--custom]
                                                       [--deleted]
                                                       [--exists]
                                                       [--interval]
                                                       [--subscription]
                                                       [--timeout]
                                                       [--updated]

Examples

Pause executing next line of CLI script until the linked service is successfully provisioned.

az monitor log-analytics workspace linked-service wait -n cluster -g MyResourceGroup --workspace-name MyWorkspace --created

Required Parameters

--name -n

Name of the linkedServices resource. Supported values: cluster, automation.

--resource-group -g

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

--workspace-name

Name of the Log Analytics Workspace.

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--deleted

Wait until deleted.

--exists

Wait until the resource exists.

--interval

Polling interval in seconds.

default value: 30
--subscription

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

--timeout

Maximum wait in seconds.

default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.