1. Packages
  2. Azure Classic
  3. API Docs
  4. loganalytics
  5. WorkspaceTable

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.loganalytics.WorkspaceTable

Explore with Pulumi AI

Manages a Table in a Log Analytics (formally Operational Insights) Workspace.

Note: This resource does not create or destroy tables. This resource is used to update attributes (currently only retention_in_days) of the tables created when a Log Analytics Workspace is created. Deleting an azure.loganalytics.WorkspaceTable resource will not delete the table. Instead, the table’s retention_in_days field will be set to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {
    name: "example-resources",
    location: "West Europe",
});
const exampleAnalyticsWorkspace = new azure.operationalinsights.AnalyticsWorkspace("example", {
    name: "example",
    location: example.location,
    resourceGroupName: example.name,
    sku: "PerGB2018",
    retentionInDays: 30,
});
const exampleWorkspaceTable = new azure.loganalytics.WorkspaceTable("example", {
    workspaceId: exampleAnalyticsWorkspace.id,
    name: "AppMetrics",
    retentionInDays: 60,
    totalRetentionInDays: 180,
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example",
    name="example-resources",
    location="West Europe")
example_analytics_workspace = azure.operationalinsights.AnalyticsWorkspace("example",
    name="example",
    location=example.location,
    resource_group_name=example.name,
    sku="PerGB2018",
    retention_in_days=30)
example_workspace_table = azure.loganalytics.WorkspaceTable("example",
    workspace_id=example_analytics_workspace.id,
    name="AppMetrics",
    retention_in_days=60,
    total_retention_in_days=180)
Copy
package main

import (
	"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("example-resources"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleAnalyticsWorkspace, err := operationalinsights.NewAnalyticsWorkspace(ctx, "example", &operationalinsights.AnalyticsWorkspaceArgs{
			Name:              pulumi.String("example"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			Sku:               pulumi.String("PerGB2018"),
			RetentionInDays:   pulumi.Int(30),
		})
		if err != nil {
			return err
		}
		_, err = loganalytics.NewWorkspaceTable(ctx, "example", &loganalytics.WorkspaceTableArgs{
			WorkspaceId:          exampleAnalyticsWorkspace.ID(),
			Name:                 pulumi.String("AppMetrics"),
			RetentionInDays:      pulumi.Int(60),
			TotalRetentionInDays: pulumi.Int(180),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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 = "example-resources",
        Location = "West Europe",
    });

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

    var exampleWorkspaceTable = new Azure.LogAnalytics.WorkspaceTable("example", new()
    {
        WorkspaceId = exampleAnalyticsWorkspace.Id,
        Name = "AppMetrics",
        RetentionInDays = 60,
        TotalRetentionInDays = 180,
    });

});
Copy
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.operationalinsights.AnalyticsWorkspace;
import com.pulumi.azure.operationalinsights.AnalyticsWorkspaceArgs;
import com.pulumi.azure.loganalytics.WorkspaceTable;
import com.pulumi.azure.loganalytics.WorkspaceTableArgs;
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("example-resources")
            .location("West Europe")
            .build());

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

        var exampleWorkspaceTable = new WorkspaceTable("exampleWorkspaceTable", WorkspaceTableArgs.builder()
            .workspaceId(exampleAnalyticsWorkspace.id())
            .name("AppMetrics")
            .retentionInDays(60)
            .totalRetentionInDays(180)
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  exampleAnalyticsWorkspace:
    type: azure:operationalinsights:AnalyticsWorkspace
    name: example
    properties:
      name: example
      location: ${example.location}
      resourceGroupName: ${example.name}
      sku: PerGB2018
      retentionInDays: 30
  exampleWorkspaceTable:
    type: azure:loganalytics:WorkspaceTable
    name: example
    properties:
      workspaceId: ${exampleAnalyticsWorkspace.id}
      name: AppMetrics
      retentionInDays: 60
      totalRetentionInDays: 180
Copy

Create WorkspaceTable Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new WorkspaceTable(name: string, args: WorkspaceTableArgs, opts?: CustomResourceOptions);
@overload
def WorkspaceTable(resource_name: str,
                   args: WorkspaceTableArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def WorkspaceTable(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   workspace_id: Optional[str] = None,
                   name: Optional[str] = None,
                   plan: Optional[str] = None,
                   retention_in_days: Optional[int] = None,
                   total_retention_in_days: Optional[int] = None)
func NewWorkspaceTable(ctx *Context, name string, args WorkspaceTableArgs, opts ...ResourceOption) (*WorkspaceTable, error)
public WorkspaceTable(string name, WorkspaceTableArgs args, CustomResourceOptions? opts = null)
public WorkspaceTable(String name, WorkspaceTableArgs args)
public WorkspaceTable(String name, WorkspaceTableArgs args, CustomResourceOptions options)
type: azure:loganalytics:WorkspaceTable
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. WorkspaceTableArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. WorkspaceTableArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. WorkspaceTableArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. WorkspaceTableArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. WorkspaceTableArgs
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 workspaceTableResource = new Azure.LogAnalytics.WorkspaceTable("workspaceTableResource", new()
{
    WorkspaceId = "string",
    Name = "string",
    Plan = "string",
    RetentionInDays = 0,
    TotalRetentionInDays = 0,
});
Copy
example, err := loganalytics.NewWorkspaceTable(ctx, "workspaceTableResource", &loganalytics.WorkspaceTableArgs{
	WorkspaceId:          pulumi.String("string"),
	Name:                 pulumi.String("string"),
	Plan:                 pulumi.String("string"),
	RetentionInDays:      pulumi.Int(0),
	TotalRetentionInDays: pulumi.Int(0),
})
Copy
var workspaceTableResource = new WorkspaceTable("workspaceTableResource", WorkspaceTableArgs.builder()
    .workspaceId("string")
    .name("string")
    .plan("string")
    .retentionInDays(0)
    .totalRetentionInDays(0)
    .build());
Copy
workspace_table_resource = azure.loganalytics.WorkspaceTable("workspaceTableResource",
    workspace_id="string",
    name="string",
    plan="string",
    retention_in_days=0,
    total_retention_in_days=0)
Copy
const workspaceTableResource = new azure.loganalytics.WorkspaceTable("workspaceTableResource", {
    workspaceId: "string",
    name: "string",
    plan: "string",
    retentionInDays: 0,
    totalRetentionInDays: 0,
});
Copy
type: azure:loganalytics:WorkspaceTable
properties:
    name: string
    plan: string
    retentionInDays: 0
    totalRetentionInDays: 0
    workspaceId: string
Copy

WorkspaceTable 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 WorkspaceTable resource accepts the following input properties:

WorkspaceId This property is required. string
The object ID of the Log Analytics Workspace that contains the table.
Name string
Specifies the name of a table in a Log Analytics Workspace.
Plan string

Specify the system how to handle and charge the logs ingested to the table. Possible values are Analytics and Basic. Defaults to Analytics.

Note: The name of tables currently supported by the Basic plan can be found here.

RetentionInDays int
The table's retention in days. Possible values are either 8 (Basic Tier only) or range between 4 and 730.
TotalRetentionInDays int

The table's total retention in days. Possible values range between 4 and 730; or 1095, 1460, 1826, 2191, 2556, 2922, 3288, 3653, 4018, or 4383.

Note: retention_in_days and total_retention_in_days will revert back to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days when a azure.loganalytics.WorkspaceTable is deleted.

Note: The retention_in_days cannot be specified when plan is Basic because the retention is fixed at eight days.

WorkspaceId This property is required. string
The object ID of the Log Analytics Workspace that contains the table.
Name string
Specifies the name of a table in a Log Analytics Workspace.
Plan string

Specify the system how to handle and charge the logs ingested to the table. Possible values are Analytics and Basic. Defaults to Analytics.

Note: The name of tables currently supported by the Basic plan can be found here.

RetentionInDays int
The table's retention in days. Possible values are either 8 (Basic Tier only) or range between 4 and 730.
TotalRetentionInDays int

The table's total retention in days. Possible values range between 4 and 730; or 1095, 1460, 1826, 2191, 2556, 2922, 3288, 3653, 4018, or 4383.

Note: retention_in_days and total_retention_in_days will revert back to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days when a azure.loganalytics.WorkspaceTable is deleted.

Note: The retention_in_days cannot be specified when plan is Basic because the retention is fixed at eight days.

workspaceId This property is required. String
The object ID of the Log Analytics Workspace that contains the table.
name String
Specifies the name of a table in a Log Analytics Workspace.
plan String

Specify the system how to handle and charge the logs ingested to the table. Possible values are Analytics and Basic. Defaults to Analytics.

Note: The name of tables currently supported by the Basic plan can be found here.

retentionInDays Integer
The table's retention in days. Possible values are either 8 (Basic Tier only) or range between 4 and 730.
totalRetentionInDays Integer

The table's total retention in days. Possible values range between 4 and 730; or 1095, 1460, 1826, 2191, 2556, 2922, 3288, 3653, 4018, or 4383.

Note: retention_in_days and total_retention_in_days will revert back to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days when a azure.loganalytics.WorkspaceTable is deleted.

Note: The retention_in_days cannot be specified when plan is Basic because the retention is fixed at eight days.

workspaceId This property is required. string
The object ID of the Log Analytics Workspace that contains the table.
name string
Specifies the name of a table in a Log Analytics Workspace.
plan string

Specify the system how to handle and charge the logs ingested to the table. Possible values are Analytics and Basic. Defaults to Analytics.

Note: The name of tables currently supported by the Basic plan can be found here.

retentionInDays number
The table's retention in days. Possible values are either 8 (Basic Tier only) or range between 4 and 730.
totalRetentionInDays number

The table's total retention in days. Possible values range between 4 and 730; or 1095, 1460, 1826, 2191, 2556, 2922, 3288, 3653, 4018, or 4383.

Note: retention_in_days and total_retention_in_days will revert back to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days when a azure.loganalytics.WorkspaceTable is deleted.

Note: The retention_in_days cannot be specified when plan is Basic because the retention is fixed at eight days.

workspace_id This property is required. str
The object ID of the Log Analytics Workspace that contains the table.
name str
Specifies the name of a table in a Log Analytics Workspace.
plan str

Specify the system how to handle and charge the logs ingested to the table. Possible values are Analytics and Basic. Defaults to Analytics.

Note: The name of tables currently supported by the Basic plan can be found here.

retention_in_days int
The table's retention in days. Possible values are either 8 (Basic Tier only) or range between 4 and 730.
total_retention_in_days int

The table's total retention in days. Possible values range between 4 and 730; or 1095, 1460, 1826, 2191, 2556, 2922, 3288, 3653, 4018, or 4383.

Note: retention_in_days and total_retention_in_days will revert back to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days when a azure.loganalytics.WorkspaceTable is deleted.

Note: The retention_in_days cannot be specified when plan is Basic because the retention is fixed at eight days.

workspaceId This property is required. String
The object ID of the Log Analytics Workspace that contains the table.
name String
Specifies the name of a table in a Log Analytics Workspace.
plan String

Specify the system how to handle and charge the logs ingested to the table. Possible values are Analytics and Basic. Defaults to Analytics.

Note: The name of tables currently supported by the Basic plan can be found here.

retentionInDays Number
The table's retention in days. Possible values are either 8 (Basic Tier only) or range between 4 and 730.
totalRetentionInDays Number

The table's total retention in days. Possible values range between 4 and 730; or 1095, 1460, 1826, 2191, 2556, 2922, 3288, 3653, 4018, or 4383.

Note: retention_in_days and total_retention_in_days will revert back to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days when a azure.loganalytics.WorkspaceTable is deleted.

Note: The retention_in_days cannot be specified when plan is Basic because the retention is fixed at eight days.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing WorkspaceTable Resource

Get an existing WorkspaceTable 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?: WorkspaceTableState, opts?: CustomResourceOptions): WorkspaceTable
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        name: Optional[str] = None,
        plan: Optional[str] = None,
        retention_in_days: Optional[int] = None,
        total_retention_in_days: Optional[int] = None,
        workspace_id: Optional[str] = None) -> WorkspaceTable
func GetWorkspaceTable(ctx *Context, name string, id IDInput, state *WorkspaceTableState, opts ...ResourceOption) (*WorkspaceTable, error)
public static WorkspaceTable Get(string name, Input<string> id, WorkspaceTableState? state, CustomResourceOptions? opts = null)
public static WorkspaceTable get(String name, Output<String> id, WorkspaceTableState state, CustomResourceOptions options)
resources:  _:    type: azure:loganalytics:WorkspaceTable    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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
Specifies the name of a table in a Log Analytics Workspace.
Plan string

Specify the system how to handle and charge the logs ingested to the table. Possible values are Analytics and Basic. Defaults to Analytics.

Note: The name of tables currently supported by the Basic plan can be found here.

RetentionInDays int
The table's retention in days. Possible values are either 8 (Basic Tier only) or range between 4 and 730.
TotalRetentionInDays int

The table's total retention in days. Possible values range between 4 and 730; or 1095, 1460, 1826, 2191, 2556, 2922, 3288, 3653, 4018, or 4383.

Note: retention_in_days and total_retention_in_days will revert back to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days when a azure.loganalytics.WorkspaceTable is deleted.

Note: The retention_in_days cannot be specified when plan is Basic because the retention is fixed at eight days.

WorkspaceId string
The object ID of the Log Analytics Workspace that contains the table.
Name string
Specifies the name of a table in a Log Analytics Workspace.
Plan string

Specify the system how to handle and charge the logs ingested to the table. Possible values are Analytics and Basic. Defaults to Analytics.

Note: The name of tables currently supported by the Basic plan can be found here.

RetentionInDays int
The table's retention in days. Possible values are either 8 (Basic Tier only) or range between 4 and 730.
TotalRetentionInDays int

The table's total retention in days. Possible values range between 4 and 730; or 1095, 1460, 1826, 2191, 2556, 2922, 3288, 3653, 4018, or 4383.

Note: retention_in_days and total_retention_in_days will revert back to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days when a azure.loganalytics.WorkspaceTable is deleted.

Note: The retention_in_days cannot be specified when plan is Basic because the retention is fixed at eight days.

WorkspaceId string
The object ID of the Log Analytics Workspace that contains the table.
name String
Specifies the name of a table in a Log Analytics Workspace.
plan String

Specify the system how to handle and charge the logs ingested to the table. Possible values are Analytics and Basic. Defaults to Analytics.

Note: The name of tables currently supported by the Basic plan can be found here.

retentionInDays Integer
The table's retention in days. Possible values are either 8 (Basic Tier only) or range between 4 and 730.
totalRetentionInDays Integer

The table's total retention in days. Possible values range between 4 and 730; or 1095, 1460, 1826, 2191, 2556, 2922, 3288, 3653, 4018, or 4383.

Note: retention_in_days and total_retention_in_days will revert back to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days when a azure.loganalytics.WorkspaceTable is deleted.

Note: The retention_in_days cannot be specified when plan is Basic because the retention is fixed at eight days.

workspaceId String
The object ID of the Log Analytics Workspace that contains the table.
name string
Specifies the name of a table in a Log Analytics Workspace.
plan string

Specify the system how to handle and charge the logs ingested to the table. Possible values are Analytics and Basic. Defaults to Analytics.

Note: The name of tables currently supported by the Basic plan can be found here.

retentionInDays number
The table's retention in days. Possible values are either 8 (Basic Tier only) or range between 4 and 730.
totalRetentionInDays number

The table's total retention in days. Possible values range between 4 and 730; or 1095, 1460, 1826, 2191, 2556, 2922, 3288, 3653, 4018, or 4383.

Note: retention_in_days and total_retention_in_days will revert back to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days when a azure.loganalytics.WorkspaceTable is deleted.

Note: The retention_in_days cannot be specified when plan is Basic because the retention is fixed at eight days.

workspaceId string
The object ID of the Log Analytics Workspace that contains the table.
name str
Specifies the name of a table in a Log Analytics Workspace.
plan str

Specify the system how to handle and charge the logs ingested to the table. Possible values are Analytics and Basic. Defaults to Analytics.

Note: The name of tables currently supported by the Basic plan can be found here.

retention_in_days int
The table's retention in days. Possible values are either 8 (Basic Tier only) or range between 4 and 730.
total_retention_in_days int

The table's total retention in days. Possible values range between 4 and 730; or 1095, 1460, 1826, 2191, 2556, 2922, 3288, 3653, 4018, or 4383.

Note: retention_in_days and total_retention_in_days will revert back to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days when a azure.loganalytics.WorkspaceTable is deleted.

Note: The retention_in_days cannot be specified when plan is Basic because the retention is fixed at eight days.

workspace_id str
The object ID of the Log Analytics Workspace that contains the table.
name String
Specifies the name of a table in a Log Analytics Workspace.
plan String

Specify the system how to handle and charge the logs ingested to the table. Possible values are Analytics and Basic. Defaults to Analytics.

Note: The name of tables currently supported by the Basic plan can be found here.

retentionInDays Number
The table's retention in days. Possible values are either 8 (Basic Tier only) or range between 4 and 730.
totalRetentionInDays Number

The table's total retention in days. Possible values range between 4 and 730; or 1095, 1460, 1826, 2191, 2556, 2922, 3288, 3653, 4018, or 4383.

Note: retention_in_days and total_retention_in_days will revert back to the value of azure.operationalinsights.AnalyticsWorkspace retention_in_days when a azure.loganalytics.WorkspaceTable is deleted.

Note: The retention_in_days cannot be specified when plan is Basic because the retention is fixed at eight days.

workspaceId String
The object ID of the Log Analytics Workspace that contains the table.

Package Details

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