We recommend using Azure Native.
azure.loganalytics.LinkedService
Explore with Pulumi AI
Manages a Log Analytics Linked Service.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "resourcegroup-01",
location: "West Europe",
});
const exampleAccount = new azure.automation.Account("example", {
name: "automation-01",
location: example.location,
resourceGroupName: example.name,
skuName: "Basic",
tags: {
environment: "development",
},
});
const exampleAnalyticsWorkspace = new azure.operationalinsights.AnalyticsWorkspace("example", {
name: "workspace-01",
location: example.location,
resourceGroupName: example.name,
sku: "PerGB2018",
retentionInDays: 30,
});
const exampleLinkedService = new azure.loganalytics.LinkedService("example", {
resourceGroupName: example.name,
workspaceId: exampleAnalyticsWorkspace.id,
readAccessId: exampleAccount.id,
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="resourcegroup-01",
location="West Europe")
example_account = azure.automation.Account("example",
name="automation-01",
location=example.location,
resource_group_name=example.name,
sku_name="Basic",
tags={
"environment": "development",
})
example_analytics_workspace = azure.operationalinsights.AnalyticsWorkspace("example",
name="workspace-01",
location=example.location,
resource_group_name=example.name,
sku="PerGB2018",
retention_in_days=30)
example_linked_service = azure.loganalytics.LinkedService("example",
resource_group_name=example.name,
workspace_id=example_analytics_workspace.id,
read_access_id=example_account.id)
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/automation"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/loganalytics"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/operationalinsights"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("resourcegroup-01"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleAccount, err := automation.NewAccount(ctx, "example", &automation.AccountArgs{
Name: pulumi.String("automation-01"),
Location: example.Location,
ResourceGroupName: example.Name,
SkuName: pulumi.String("Basic"),
Tags: pulumi.StringMap{
"environment": pulumi.String("development"),
},
})
if err != nil {
return err
}
exampleAnalyticsWorkspace, err := operationalinsights.NewAnalyticsWorkspace(ctx, "example", &operationalinsights.AnalyticsWorkspaceArgs{
Name: pulumi.String("workspace-01"),
Location: example.Location,
ResourceGroupName: example.Name,
Sku: pulumi.String("PerGB2018"),
RetentionInDays: pulumi.Int(30),
})
if err != nil {
return err
}
_, err = loganalytics.NewLinkedService(ctx, "example", &loganalytics.LinkedServiceArgs{
ResourceGroupName: example.Name,
WorkspaceId: exampleAnalyticsWorkspace.ID(),
ReadAccessId: exampleAccount.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "resourcegroup-01",
Location = "West Europe",
});
var exampleAccount = new Azure.Automation.Account("example", new()
{
Name = "automation-01",
Location = example.Location,
ResourceGroupName = example.Name,
SkuName = "Basic",
Tags =
{
{ "environment", "development" },
},
});
var exampleAnalyticsWorkspace = new Azure.OperationalInsights.AnalyticsWorkspace("example", new()
{
Name = "workspace-01",
Location = example.Location,
ResourceGroupName = example.Name,
Sku = "PerGB2018",
RetentionInDays = 30,
});
var exampleLinkedService = new Azure.LogAnalytics.LinkedService("example", new()
{
ResourceGroupName = example.Name,
WorkspaceId = exampleAnalyticsWorkspace.Id,
ReadAccessId = exampleAccount.Id,
});
});
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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("resourcegroup-01")
.location("West Europe")
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.name("automation-01")
.location(example.location())
.resourceGroupName(example.name())
.skuName("Basic")
.tags(Map.of("environment", "development"))
.build());
var exampleAnalyticsWorkspace = new AnalyticsWorkspace("exampleAnalyticsWorkspace", AnalyticsWorkspaceArgs.builder()
.name("workspace-01")
.location(example.location())
.resourceGroupName(example.name())
.sku("PerGB2018")
.retentionInDays(30)
.build());
var exampleLinkedService = new LinkedService("exampleLinkedService", LinkedServiceArgs.builder()
.resourceGroupName(example.name())
.workspaceId(exampleAnalyticsWorkspace.id())
.readAccessId(exampleAccount.id())
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: resourcegroup-01
location: West Europe
exampleAccount:
type: azure:automation:Account
name: example
properties:
name: automation-01
location: ${example.location}
resourceGroupName: ${example.name}
skuName: Basic
tags:
environment: development
exampleAnalyticsWorkspace:
type: azure:operationalinsights:AnalyticsWorkspace
name: example
properties:
name: workspace-01
location: ${example.location}
resourceGroupName: ${example.name}
sku: PerGB2018
retentionInDays: 30
exampleLinkedService:
type: azure:loganalytics:LinkedService
name: example
properties:
resourceGroupName: ${example.name}
workspaceId: ${exampleAnalyticsWorkspace.id}
readAccessId: ${exampleAccount.id}
Create LinkedService Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new LinkedService(name: string, args: LinkedServiceArgs, opts?: CustomResourceOptions);
@overload
def LinkedService(resource_name: str,
args: LinkedServiceArgs,
opts: Optional[ResourceOptions] = None)
@overload
def LinkedService(resource_name: str,
opts: Optional[ResourceOptions] = None,
resource_group_name: Optional[str] = None,
workspace_id: Optional[str] = None,
read_access_id: Optional[str] = None,
write_access_id: Optional[str] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var linkedServiceResource = new Azure.LogAnalytics.LinkedService("linkedServiceResource", new()
{
ResourceGroupName = "string",
WorkspaceId = "string",
ReadAccessId = "string",
WriteAccessId = "string",
});
example, err := loganalytics.NewLinkedService(ctx, "linkedServiceResource", &loganalytics.LinkedServiceArgs{
ResourceGroupName: pulumi.String("string"),
WorkspaceId: pulumi.String("string"),
ReadAccessId: pulumi.String("string"),
WriteAccessId: pulumi.String("string"),
})
var linkedServiceResource = new LinkedService("linkedServiceResource", LinkedServiceArgs.builder()
.resourceGroupName("string")
.workspaceId("string")
.readAccessId("string")
.writeAccessId("string")
.build());
linked_service_resource = azure.loganalytics.LinkedService("linkedServiceResource",
resource_group_name="string",
workspace_id="string",
read_access_id="string",
write_access_id="string")
const linkedServiceResource = new azure.loganalytics.LinkedService("linkedServiceResource", {
resourceGroupName: "string",
workspaceId: "string",
readAccessId: "string",
writeAccessId: "string",
});
type: azure:loganalytics:LinkedService
properties:
readAccessId: string
resourceGroupName: string
workspaceId: string
writeAccessId: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The LinkedService resource accepts the following input properties:
- Resource
Group stringName - 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 string - The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource.
- Read
Access stringId - 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 stringId 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.
NOTE: You must define at least one of the above access resource id attributes (e.g.
read_access_id
orwrite_access_id
).
- Resource
Group stringName - 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 string - The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource.
- Read
Access stringId - 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 stringId 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.
NOTE: You must define at least one of the above access resource id attributes (e.g.
read_access_id
orwrite_access_id
).
- resource
Group StringName - 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 String - The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource.
- read
Access StringId - 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 StringId 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.
NOTE: You must define at least one of the above access resource id attributes (e.g.
read_access_id
orwrite_access_id
).
- resource
Group stringName - 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 string - The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource.
- read
Access stringId - 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 stringId 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.
NOTE: You must define at least one of the above access resource id attributes (e.g.
read_access_id
orwrite_access_id
).
- resource_
group_ strname - 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.
- read_
access_ strid - 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_ strid 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.
NOTE: You must define at least one of the above access resource id attributes (e.g.
read_access_id
orwrite_access_id
).
- resource
Group StringName - 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 String - The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource.
- read
Access StringId - 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 StringId 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.
NOTE: You must define at least one of the above access resource id attributes (e.g.
read_access_id
orwrite_access_id
).
Outputs
All input properties are implicitly available as output properties. Additionally, the LinkedService resource produces the following output properties:
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.
- 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
orworkspace1/Cluster
) - Read
Access stringId - 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 stringName - 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 string - The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource.
- Write
Access stringId 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.
NOTE: You must define at least one of the above access resource id attributes (e.g.
read_access_id
orwrite_access_id
).
- 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
orworkspace1/Cluster
) - Read
Access stringId - 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 stringName - 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 string - The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource.
- Write
Access stringId 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.
NOTE: You must define at least one of the above access resource id attributes (e.g.
read_access_id
orwrite_access_id
).
- 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
orworkspace1/Cluster
) - read
Access StringId - 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 StringName - 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 String - The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource.
- write
Access StringId 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.
NOTE: You must define at least one of the above access resource id attributes (e.g.
read_access_id
orwrite_access_id
).
- 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
orworkspace1/Cluster
) - read
Access stringId - 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 stringName - 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 string - The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource.
- write
Access stringId 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.
NOTE: You must define at least one of the above access resource id attributes (e.g.
read_access_id
orwrite_access_id
).
- 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
orworkspace1/Cluster
) - read_
access_ strid - 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_ strname - 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.
- write_
access_ strid 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.
NOTE: You must define at least one of the above access resource id attributes (e.g.
read_access_id
orwrite_access_id
).
- 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
orworkspace1/Cluster
) - read
Access StringId - 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 StringName - 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 String - The ID of the Log Analytics Workspace that will contain the Log Analytics Linked Service resource.
- write
Access StringId 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.
NOTE: You must define at least one of the above access resource id attributes (e.g.
read_access_id
orwrite_access_id
).
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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurerm
Terraform Provider.