Microsoft.OperationalInsights workspaces/linkedServices 2025-07-01

Bicep resource definition

The workspaces/linkedServices resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Usage Examples

Bicep Samples

A basic example of deploying Log Analytics Linked Service.

param resourceName string = 'acctest0001'
param location string = 'westeurope'

resource workspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
  name: resourceName
  location: location
  properties: {
    features: {
      disableLocalAuth: false
      enableLogAccessUsingOnlyResourcePermissions: true
    }
    publicNetworkAccessForIngestion: 'Enabled'
    publicNetworkAccessForQuery: 'Enabled'
    retentionInDays: 30
    sku: {
      name: 'PerGB2018'
    }
    workspaceCapping: {
      dailyQuotaGb: -1
    }
  }
}

resource linkedService 'Microsoft.OperationalInsights/workspaces/linkedServices@2020-08-01' = {
  name: 'Automation'
  parent: workspace
  properties: {
    resourceId: automationAccount.id
  }
}

resource automationAccount 'Microsoft.Automation/automationAccounts@2021-06-22' = {
  name: resourceName
  location: location
  properties: {
    encryption: {
      keySource: 'Microsoft.Automation'
    }
    publicNetworkAccess: true
    sku: {
      name: 'Basic'
    }
  }
}

Azure Verified Modules

The following Azure Verified Modules can be used to deploy this resource type.

Module Description
Log Analytics Workspace - Linked Service AVM Child Module for Log Analytics Workspace - Linked Service

Azure Quickstart Samples

The following Azure Quickstart templates contain Bicep samples for deploying this resource type.

Bicep File Description
Log Analytics workspace with solutions and data sources Deploys a Log Analytics workspace with specified solutions and data sources

Resource format

To create a Microsoft.OperationalInsights/workspaces/linkedServices resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.OperationalInsights/workspaces/linkedServices@2025-07-01' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    provisioningState: 'string'
    resourceId: 'string'
    writeAccessResourceId: 'string'
  }
  tags: {
    {customized property}: 'string'
  }
}

Property Values

Microsoft.OperationalInsights/workspaces/linkedServices

Name Description Value
name The resource name string (required)
parent In Bicep, you can specify the parent resource for a child resource. You only need to add this property when the child resource is declared outside of the parent resource.

For more information, see Child resource outside parent resource.
Symbolic name for resource of type: workspaces
properties The properties of the linked service. LinkedServiceProperties (required)
tags Resource tags Dictionary of tag names and values. See Tags in templates

LinkedServiceProperties

Name Description Value
provisioningState The provisioning state of the linked service. 'Deleting'
'ProvisioningAccount'
'Succeeded'
'Updating'
resourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require read access string
writeAccessResourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require write access string

LinkedServiceTags

Name Description Value

ARM template resource definition

The workspaces/linkedServices resource type can be deployed with operations that target:

Usage Examples

Azure Quickstart Templates

The following Azure Quickstart templates deploy this resource type.

Template Description
Create Azure Automation account

Deploy to Azure
This template provides an example of how create an Azure Automation account and links it to a new or existing Azure Monitor Log Analytics workspace.
Log Analytics workspace with solutions and data sources

Deploy to Azure
Deploys a Log Analytics workspace with specified solutions and data sources

Resource format

To create a Microsoft.OperationalInsights/workspaces/linkedServices resource, add the following JSON to your template.

{
  "type": "Microsoft.OperationalInsights/workspaces/linkedServices",
  "apiVersion": "2025-07-01",
  "name": "string",
  "properties": {
    "provisioningState": "string",
    "resourceId": "string",
    "writeAccessResourceId": "string"
  },
  "tags": {
    "{customized property}": "string"
  }
}

Property Values

Microsoft.OperationalInsights/workspaces/linkedServices

Name Description Value
apiVersion The api version '2025-07-01'
name The resource name string (required)
properties The properties of the linked service. LinkedServiceProperties (required)
tags Resource tags Dictionary of tag names and values. See Tags in templates
type The resource type 'Microsoft.OperationalInsights/workspaces/linkedServices'

LinkedServiceProperties

Name Description Value
provisioningState The provisioning state of the linked service. 'Deleting'
'ProvisioningAccount'
'Succeeded'
'Updating'
resourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require read access string
writeAccessResourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require write access string

LinkedServiceTags

Name Description Value

Terraform (AzAPI provider) resource definition

The workspaces/linkedServices resource type can be deployed with operations that target:

  • Resource groups For a list of changed properties in each API version, see change log.

Usage Examples

Terraform Samples

A basic example of deploying Log Analytics Linked Service.

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "workspace" {
  type      = "Microsoft.OperationalInsights/workspaces@2022-10-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      features = {
        disableLocalAuth                            = false
        enableLogAccessUsingOnlyResourcePermissions = true
      }
      publicNetworkAccessForIngestion = "Enabled"
      publicNetworkAccessForQuery     = "Enabled"
      retentionInDays                 = 30
      sku = {
        name = "PerGB2018"
      }
      workspaceCapping = {
        dailyQuotaGb = -1
      }
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "automationAccount" {
  type      = "Microsoft.Automation/automationAccounts@2021-06-22"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      encryption = {
        keySource = "Microsoft.Automation"
      }
      publicNetworkAccess = true
      sku = {
        name = "Basic"
      }
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "linkedService" {
  type      = "Microsoft.OperationalInsights/workspaces/linkedServices@2020-08-01"
  parent_id = azapi_resource.workspace.id
  name      = "Automation"
  body = {
    properties = {
      resourceId = azapi_resource.automationAccount.id
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

Resource format

To create a Microsoft.OperationalInsights/workspaces/linkedServices resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.OperationalInsights/workspaces/linkedServices@2025-07-01"
  name = "string"
  parent_id = "string"
  tags = {
    {customized property} = "string"
  }
  body = {
    properties = {
      provisioningState = "string"
      resourceId = "string"
      writeAccessResourceId = "string"
    }
  }
}

Property Values

Microsoft.OperationalInsights/workspaces/linkedServices

Name Description Value
name The resource name string (required)
parent_id The ID of the resource that is the parent for this resource. ID for resource of type: workspaces
properties The properties of the linked service. LinkedServiceProperties (required)
tags Resource tags Dictionary of tag names and values.
type The resource type "Microsoft.OperationalInsights/workspaces/linkedServices@2025-07-01"

LinkedServiceProperties

Name Description Value
provisioningState The provisioning state of the linked service. 'Deleting'
'ProvisioningAccount'
'Succeeded'
'Updating'
resourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require read access string
writeAccessResourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require write access string

LinkedServiceTags

Name Description Value