1. Packages
  2. Azure Classic
  3. API Docs
  4. operationalinsights
  5. getAnalyticsWorkspace

We recommend using Azure Native.

Azure Classic v5.72.0 published on Monday, Apr 15, 2024 by Pulumi

azure.operationalinsights.getAnalyticsWorkspace

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.72.0 published on Monday, Apr 15, 2024 by Pulumi

    Use this data source to access information about an existing Log Analytics (formally Operational Insights) Workspace.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.operationalinsights.getAnalyticsWorkspace({
        name: "acctest-01",
        resourceGroupName: "acctest",
    });
    export const logAnalyticsWorkspaceId = example.then(example => example.workspaceId);
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.operationalinsights.get_analytics_workspace(name="acctest-01",
        resource_group_name="acctest")
    pulumi.export("logAnalyticsWorkspaceId", example.workspace_id)
    
    package main
    
    import (
    	"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 {
    		example, err := operationalinsights.LookupAnalyticsWorkspace(ctx, &operationalinsights.LookupAnalyticsWorkspaceArgs{
    			Name:              "acctest-01",
    			ResourceGroupName: "acctest",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("logAnalyticsWorkspaceId", example.WorkspaceId)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Azure.OperationalInsights.GetAnalyticsWorkspace.Invoke(new()
        {
            Name = "acctest-01",
            ResourceGroupName = "acctest",
        });
    
        return new Dictionary<string, object?>
        {
            ["logAnalyticsWorkspaceId"] = example.Apply(getAnalyticsWorkspaceResult => getAnalyticsWorkspaceResult.WorkspaceId),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.operationalinsights.OperationalinsightsFunctions;
    import com.pulumi.azure.operationalinsights.inputs.GetAnalyticsWorkspaceArgs;
    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) {
            final var example = OperationalinsightsFunctions.getAnalyticsWorkspace(GetAnalyticsWorkspaceArgs.builder()
                .name("acctest-01")
                .resourceGroupName("acctest")
                .build());
    
            ctx.export("logAnalyticsWorkspaceId", example.applyValue(getAnalyticsWorkspaceResult -> getAnalyticsWorkspaceResult.workspaceId()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: azure:operationalinsights:getAnalyticsWorkspace
          Arguments:
            name: acctest-01
            resourceGroupName: acctest
    outputs:
      logAnalyticsWorkspaceId: ${example.workspaceId}
    

    Using getAnalyticsWorkspace

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getAnalyticsWorkspace(args: GetAnalyticsWorkspaceArgs, opts?: InvokeOptions): Promise<GetAnalyticsWorkspaceResult>
    function getAnalyticsWorkspaceOutput(args: GetAnalyticsWorkspaceOutputArgs, opts?: InvokeOptions): Output<GetAnalyticsWorkspaceResult>
    def get_analytics_workspace(name: Optional[str] = None,
                                resource_group_name: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetAnalyticsWorkspaceResult
    def get_analytics_workspace_output(name: Optional[pulumi.Input[str]] = None,
                                resource_group_name: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetAnalyticsWorkspaceResult]
    func LookupAnalyticsWorkspace(ctx *Context, args *LookupAnalyticsWorkspaceArgs, opts ...InvokeOption) (*LookupAnalyticsWorkspaceResult, error)
    func LookupAnalyticsWorkspaceOutput(ctx *Context, args *LookupAnalyticsWorkspaceOutputArgs, opts ...InvokeOption) LookupAnalyticsWorkspaceResultOutput

    > Note: This function is named LookupAnalyticsWorkspace in the Go SDK.

    public static class GetAnalyticsWorkspace 
    {
        public static Task<GetAnalyticsWorkspaceResult> InvokeAsync(GetAnalyticsWorkspaceArgs args, InvokeOptions? opts = null)
        public static Output<GetAnalyticsWorkspaceResult> Invoke(GetAnalyticsWorkspaceInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAnalyticsWorkspaceResult> getAnalyticsWorkspace(GetAnalyticsWorkspaceArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: azure:operationalinsights/getAnalyticsWorkspace:getAnalyticsWorkspace
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Specifies the name of the Log Analytics Workspace.
    ResourceGroupName string
    The name of the resource group in which the Log Analytics workspace is located in.
    Name string
    Specifies the name of the Log Analytics Workspace.
    ResourceGroupName string
    The name of the resource group in which the Log Analytics workspace is located in.
    name String
    Specifies the name of the Log Analytics Workspace.
    resourceGroupName String
    The name of the resource group in which the Log Analytics workspace is located in.
    name string
    Specifies the name of the Log Analytics Workspace.
    resourceGroupName string
    The name of the resource group in which the Log Analytics workspace is located in.
    name str
    Specifies the name of the Log Analytics Workspace.
    resource_group_name str
    The name of the resource group in which the Log Analytics workspace is located in.
    name String
    Specifies the name of the Log Analytics Workspace.
    resourceGroupName String
    The name of the resource group in which the Log Analytics workspace is located in.

    getAnalyticsWorkspace Result

    The following output properties are available:

    DailyQuotaGb double
    The workspace daily quota for ingestion in GB.
    Id string
    The provider-assigned unique ID for this managed resource.
    Location string
    Name string
    PrimarySharedKey string
    The Primary shared key for the Log Analytics Workspace.
    ResourceGroupName string
    RetentionInDays int
    The workspace data retention in days.
    SecondarySharedKey string
    The Secondary shared key for the Log Analytics Workspace.
    Sku string
    The SKU of the Log Analytics Workspace.
    Tags Dictionary<string, string>
    A mapping of tags assigned to the resource.
    WorkspaceId string
    The Workspace (or Customer) ID for the Log Analytics Workspace.
    DailyQuotaGb float64
    The workspace daily quota for ingestion in GB.
    Id string
    The provider-assigned unique ID for this managed resource.
    Location string
    Name string
    PrimarySharedKey string
    The Primary shared key for the Log Analytics Workspace.
    ResourceGroupName string
    RetentionInDays int
    The workspace data retention in days.
    SecondarySharedKey string
    The Secondary shared key for the Log Analytics Workspace.
    Sku string
    The SKU of the Log Analytics Workspace.
    Tags map[string]string
    A mapping of tags assigned to the resource.
    WorkspaceId string
    The Workspace (or Customer) ID for the Log Analytics Workspace.
    dailyQuotaGb Double
    The workspace daily quota for ingestion in GB.
    id String
    The provider-assigned unique ID for this managed resource.
    location String
    name String
    primarySharedKey String
    The Primary shared key for the Log Analytics Workspace.
    resourceGroupName String
    retentionInDays Integer
    The workspace data retention in days.
    secondarySharedKey String
    The Secondary shared key for the Log Analytics Workspace.
    sku String
    The SKU of the Log Analytics Workspace.
    tags Map<String,String>
    A mapping of tags assigned to the resource.
    workspaceId String
    The Workspace (or Customer) ID for the Log Analytics Workspace.
    dailyQuotaGb number
    The workspace daily quota for ingestion in GB.
    id string
    The provider-assigned unique ID for this managed resource.
    location string
    name string
    primarySharedKey string
    The Primary shared key for the Log Analytics Workspace.
    resourceGroupName string
    retentionInDays number
    The workspace data retention in days.
    secondarySharedKey string
    The Secondary shared key for the Log Analytics Workspace.
    sku string
    The SKU of the Log Analytics Workspace.
    tags {[key: string]: string}
    A mapping of tags assigned to the resource.
    workspaceId string
    The Workspace (or Customer) ID for the Log Analytics Workspace.
    daily_quota_gb float
    The workspace daily quota for ingestion in GB.
    id str
    The provider-assigned unique ID for this managed resource.
    location str
    name str
    primary_shared_key str
    The Primary shared key for the Log Analytics Workspace.
    resource_group_name str
    retention_in_days int
    The workspace data retention in days.
    secondary_shared_key str
    The Secondary shared key for the Log Analytics Workspace.
    sku str
    The SKU of the Log Analytics Workspace.
    tags Mapping[str, str]
    A mapping of tags assigned to the resource.
    workspace_id str
    The Workspace (or Customer) ID for the Log Analytics Workspace.
    dailyQuotaGb Number
    The workspace daily quota for ingestion in GB.
    id String
    The provider-assigned unique ID for this managed resource.
    location String
    name String
    primarySharedKey String
    The Primary shared key for the Log Analytics Workspace.
    resourceGroupName String
    retentionInDays Number
    The workspace data retention in days.
    secondarySharedKey String
    The Secondary shared key for the Log Analytics Workspace.
    sku String
    The SKU of the Log Analytics Workspace.
    tags Map<String>
    A mapping of tags assigned to the resource.
    workspaceId String
    The Workspace (or Customer) ID for the Log Analytics Workspace.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.72.0 published on Monday, Apr 15, 2024 by Pulumi