Azure Classic

v5.24.0 published on Wednesday, Nov 9, 2022 by Pulumi

LinkedService

Manages a Log Analytics Linked Service.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
    {
        Location = "West Europe",
    });

    var exampleAccount = new Azure.Automation.Account("exampleAccount", new()
    {
        Location = exampleResourceGroup.Location,
        ResourceGroupName = exampleResourceGroup.Name,
        SkuName = "Basic",
        Tags = 
        {
            { "environment", "development" },
        },
    });

    var exampleAnalyticsWorkspace = new Azure.OperationalInsights.AnalyticsWorkspace("exampleAnalyticsWorkspace", new()
    {
        Location = exampleResourceGroup.Location,
        ResourceGroupName = exampleResourceGroup.Name,
        Sku = "PerGB2018",
        RetentionInDays = 30,
    });

    var exampleLinkedService = new Azure.LogAnalytics.LinkedService("exampleLinkedService", new()
    {
        ResourceGroupName = exampleResourceGroup.Name,
        WorkspaceId = exampleAnalyticsWorkspace.Id,
        ReadAccessId = exampleAccount.Id,
    });

});
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/automation"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/loganalytics"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/operationalinsights"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleAccount, err := automation.NewAccount(ctx, "exampleAccount", &automation.AccountArgs{
			Location:          exampleResourceGroup.Location,
			ResourceGroupName: exampleResourceGroup.Name,
			SkuName:           pulumi.String("Basic"),
			Tags: pulumi.StringMap{
				"environment": pulumi.String("development"),
			},
		})
		if err != nil {
			return err
		}
		exampleAnalyticsWorkspace, err := operationalinsights.NewAnalyticsWorkspace(ctx, "exampleAnalyticsWorkspace", &operationalinsights.AnalyticsWorkspaceArgs{
			Location:          exampleResourceGroup.Location,
			ResourceGroupName: exampleResourceGroup.Name,
			Sku:               pulumi.String("PerGB2018"),
			RetentionInDays:   pulumi.Int(30),
		})
		if err != nil {
			return err
		}
		_, err = loganalytics.NewLinkedService(ctx, "exampleLinkedService", &loganalytics.LinkedServiceArgs{
			ResourceGroupName: exampleResourceGroup.Name,
			WorkspaceId:       exampleAnalyticsWorkspace.ID(),
			ReadAccessId:      exampleAccount.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.automation.Account;
import com.pulumi.azure.automation.AccountArgs;
import com.pulumi.azure.operationalinsights.AnalyticsWorkspace;
import com.pulumi.azure.operationalinsights.AnalyticsWorkspaceArgs;
import com.pulumi.azure.loganalytics.LinkedService;
import com.pulumi.azure.loganalytics.LinkedServiceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var exampleAccount = new Account("exampleAccount", AccountArgs.builder()        
            .location(exampleResourceGroup.location())
            .resourceGroupName(exampleResourceGroup.name())
            .skuName("Basic")
            .tags(Map.of("environment", "development"))
            .build());

        var exampleAnalyticsWorkspace = new AnalyticsWorkspace("exampleAnalyticsWorkspace", AnalyticsWorkspaceArgs.builder()        
            .location(exampleResourceGroup.location())
            .resourceGroupName(exampleResourceGroup.name())
            .sku("PerGB2018")
            .retentionInDays(30)
            .build());

        var exampleLinkedService = new LinkedService("exampleLinkedService", LinkedServiceArgs.builder()        
            .resourceGroupName(exampleResourceGroup.name())
            .workspaceId(exampleAnalyticsWorkspace.id())
            .readAccessId(exampleAccount.id())
            .build());

    }
}
import pulumi
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_account = azure.automation.Account("exampleAccount",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    sku_name="Basic",
    tags={
        "environment": "development",
    })
example_analytics_workspace = azure.operationalinsights.AnalyticsWorkspace("exampleAnalyticsWorkspace",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    sku="PerGB2018",
    retention_in_days=30)
example_linked_service = azure.loganalytics.LinkedService("exampleLinkedService",
    resource_group_name=example_resource_group.name,
    workspace_id=example_analytics_workspace.id,
    read_access_id=example_account.id)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleAccount = new azure.automation.Account("exampleAccount", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    skuName: "Basic",
    tags: {
        environment: "development",
    },
});
const exampleAnalyticsWorkspace = new azure.operationalinsights.AnalyticsWorkspace("exampleAnalyticsWorkspace", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    sku: "PerGB2018",
    retentionInDays: 30,
});
const exampleLinkedService = new azure.loganalytics.LinkedService("exampleLinkedService", {
    resourceGroupName: exampleResourceGroup.name,
    workspaceId: exampleAnalyticsWorkspace.id,
    readAccessId: exampleAccount.id,
});
resources:
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  exampleAccount:
    type: azure:automation:Account
    properties:
      location: ${exampleResourceGroup.location}
      resourceGroupName: ${exampleResourceGroup.name}
      skuName: Basic
      tags:
        environment: development
  exampleAnalyticsWorkspace:
    type: azure:operationalinsights:AnalyticsWorkspace
    properties:
      location: ${exampleResourceGroup.location}
      resourceGroupName: ${exampleResourceGroup.name}
      sku: PerGB2018
      retentionInDays: 30
  exampleLinkedService:
    type: azure:loganalytics:LinkedService
    properties:
      resourceGroupName: ${exampleResourceGroup.name}
      workspaceId: ${exampleAnalyticsWorkspace.id}
      readAccessId: ${exampleAccount.id}

Create LinkedService Resource

new LinkedService(name: string, args: LinkedServiceArgs, opts?: CustomResourceOptions);
@overload
def LinkedService(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  read_access_id: Optional[str] = None,
                  resource_group_name: Optional[str] = None,
                  workspace_id: Optional[str] = None,
                  write_access_id: Optional[str] = None)
@overload
def LinkedService(resource_name: str,
                  args: LinkedServiceArgs,
                  opts: Optional[ResourceOptions] = None)
func NewLinkedService(ctx *Context, name string, args LinkedServiceArgs, opts ...ResourceOption) (*LinkedService, error)
public LinkedService(string name, LinkedServiceArgs args, CustomResourceOptions? opts = null)
public LinkedService(String name, LinkedServiceArgs args)
public LinkedService(String name, LinkedServiceArgs args, CustomResourceOptions options)
type: azure:loganalytics:LinkedService
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args LinkedServiceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args LinkedServiceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args LinkedServiceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args LinkedServiceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args LinkedServiceArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

LinkedService Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The LinkedService resource accepts the following input properties:

ResourceGroupName string

The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.

WorkspaceId string

The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource. Changing this forces a new resource to be created.

ReadAccessId string

The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.

WriteAccessId string

The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.

ResourceGroupName string

The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.

WorkspaceId string

The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource. Changing this forces a new resource to be created.

ReadAccessId string

The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.

WriteAccessId string

The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.

resourceGroupName String

The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.

workspaceId String

The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource. Changing this forces a new resource to be created.

readAccessId String

The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.

writeAccessId String

The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.

resourceGroupName string

The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.

workspaceId string

The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource. Changing this forces a new resource to be created.

readAccessId string

The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.

writeAccessId string

The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.

resource_group_name str

The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.

workspace_id str

The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource. Changing this forces a new resource to be created.

read_access_id str

The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.

write_access_id str

The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.

resourceGroupName String

The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.

workspaceId String

The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource. Changing this forces a new resource to be created.

readAccessId String

The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.

writeAccessId String

The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the LinkedService resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Name string

The generated name of the Linked Service. The format for this attribute is always <workspace name>/<linked service type>(e.g. workspace1/Automation or workspace1/Cluster)

Id string

The provider-assigned unique ID for this managed resource.

Name string

The generated name of the Linked Service. The format for this attribute is always <workspace name>/<linked service type>(e.g. workspace1/Automation or workspace1/Cluster)

id String

The provider-assigned unique ID for this managed resource.

name String

The generated name of the Linked Service. The format for this attribute is always <workspace name>/<linked service type>(e.g. workspace1/Automation or workspace1/Cluster)

id string

The provider-assigned unique ID for this managed resource.

name string

The generated name of the Linked Service. The format for this attribute is always <workspace name>/<linked service type>(e.g. workspace1/Automation or workspace1/Cluster)

id str

The provider-assigned unique ID for this managed resource.

name str

The generated name of the Linked Service. The format for this attribute is always <workspace name>/<linked service type>(e.g. workspace1/Automation or workspace1/Cluster)

id String

The provider-assigned unique ID for this managed resource.

name String

The generated name of the Linked Service. The format for this attribute is always <workspace name>/<linked service type>(e.g. workspace1/Automation or workspace1/Cluster)

Look up Existing LinkedService Resource

Get an existing LinkedService resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: LinkedServiceState, opts?: CustomResourceOptions): LinkedService
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        name: Optional[str] = None,
        read_access_id: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        workspace_id: Optional[str] = None,
        write_access_id: Optional[str] = None) -> LinkedService
func GetLinkedService(ctx *Context, name string, id IDInput, state *LinkedServiceState, opts ...ResourceOption) (*LinkedService, error)
public static LinkedService Get(string name, Input<string> id, LinkedServiceState? state, CustomResourceOptions? opts = null)
public static LinkedService get(String name, Output<String> id, LinkedServiceState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Name string

The generated name of the Linked Service. The format for this attribute is always <workspace name>/<linked service type>(e.g. workspace1/Automation or workspace1/Cluster)

ReadAccessId string

The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.

ResourceGroupName string

The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.

WorkspaceId string

The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource. Changing this forces a new resource to be created.

WriteAccessId string

The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.

Name string

The generated name of the Linked Service. The format for this attribute is always <workspace name>/<linked service type>(e.g. workspace1/Automation or workspace1/Cluster)

ReadAccessId string

The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.

ResourceGroupName string

The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.

WorkspaceId string

The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource. Changing this forces a new resource to be created.

WriteAccessId string

The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.

name String

The generated name of the Linked Service. The format for this attribute is always <workspace name>/<linked service type>(e.g. workspace1/Automation or workspace1/Cluster)

readAccessId String

The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.

resourceGroupName String

The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.

workspaceId String

The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource. Changing this forces a new resource to be created.

writeAccessId String

The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.

name string

The generated name of the Linked Service. The format for this attribute is always <workspace name>/<linked service type>(e.g. workspace1/Automation or workspace1/Cluster)

readAccessId string

The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.

resourceGroupName string

The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.

workspaceId string

The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource. Changing this forces a new resource to be created.

writeAccessId string

The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.

name str

The generated name of the Linked Service. The format for this attribute is always <workspace name>/<linked service type>(e.g. workspace1/Automation or workspace1/Cluster)

read_access_id str

The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.

resource_group_name str

The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.

workspace_id str

The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource. Changing this forces a new resource to be created.

write_access_id str

The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.

name String

The generated name of the Linked Service. The format for this attribute is always <workspace name>/<linked service type>(e.g. workspace1/Automation or workspace1/Cluster)

readAccessId String

The ID of the readable Resource that will be linked to the workspace. This should be used for linking to an Automation Account resource.

resourceGroupName String

The name of the resource group in which the Log Analytics Linked Service is created. Changing this forces a new resource to be created.

workspaceId String

The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource. Changing this forces a new resource to be created.

writeAccessId String

The ID of the writable Resource that will be linked to the workspace. This should be used for linking to a Log Analytics Cluster resource.

Import

Log Analytics Workspaces can be imported using the resource id, e.g.

 $ pulumi import azure:loganalytics/linkedService:LinkedService example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.OperationalInsights/workspaces/workspace1/linkedServices/Automation

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.