1. Packages
  2. Azure Classic
  3. API Docs
  4. cosmosdb
  5. Table

We recommend using Azure Native.

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

azure.cosmosdb.Table

Explore with Pulumi AI

Manages a Table within a Cosmos DB Account.

Example Usage

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

const example = azure.cosmosdb.getAccount({
    name: "tfex-cosmosdb-account",
    resourceGroupName: "tfex-cosmosdb-account-rg",
});
const exampleTable = new azure.cosmosdb.Table("example", {
    name: "tfex-cosmos-table",
    resourceGroupName: example.then(example => example.resourceGroupName),
    accountName: example.then(example => example.name),
    throughput: 400,
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.cosmosdb.get_account(name="tfex-cosmosdb-account",
    resource_group_name="tfex-cosmosdb-account-rg")
example_table = azure.cosmosdb.Table("example",
    name="tfex-cosmos-table",
    resource_group_name=example.resource_group_name,
    account_name=example.name,
    throughput=400)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/cosmosdb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := cosmosdb.LookupAccount(ctx, &cosmosdb.LookupAccountArgs{
			Name:              "tfex-cosmosdb-account",
			ResourceGroupName: "tfex-cosmosdb-account-rg",
		}, nil)
		if err != nil {
			return err
		}
		_, err = cosmosdb.NewTable(ctx, "example", &cosmosdb.TableArgs{
			Name:              pulumi.String("tfex-cosmos-table"),
			ResourceGroupName: pulumi.String(example.ResourceGroupName),
			AccountName:       pulumi.String(example.Name),
			Throughput:        pulumi.Int(400),
		})
		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 = Azure.CosmosDB.GetAccount.Invoke(new()
    {
        Name = "tfex-cosmosdb-account",
        ResourceGroupName = "tfex-cosmosdb-account-rg",
    });

    var exampleTable = new Azure.CosmosDB.Table("example", new()
    {
        Name = "tfex-cosmos-table",
        ResourceGroupName = example.Apply(getAccountResult => getAccountResult.ResourceGroupName),
        AccountName = example.Apply(getAccountResult => getAccountResult.Name),
        Throughput = 400,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.cosmosdb.CosmosdbFunctions;
import com.pulumi.azure.cosmosdb.inputs.GetAccountArgs;
import com.pulumi.azure.cosmosdb.Table;
import com.pulumi.azure.cosmosdb.TableArgs;
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 = CosmosdbFunctions.getAccount(GetAccountArgs.builder()
            .name("tfex-cosmosdb-account")
            .resourceGroupName("tfex-cosmosdb-account-rg")
            .build());

        var exampleTable = new Table("exampleTable", TableArgs.builder()
            .name("tfex-cosmos-table")
            .resourceGroupName(example.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
            .accountName(example.applyValue(getAccountResult -> getAccountResult.name()))
            .throughput(400)
            .build());

    }
}
Copy
resources:
  exampleTable:
    type: azure:cosmosdb:Table
    name: example
    properties:
      name: tfex-cosmos-table
      resourceGroupName: ${example.resourceGroupName}
      accountName: ${example.name}
      throughput: 400
variables:
  example:
    fn::invoke:
      function: azure:cosmosdb:getAccount
      arguments:
        name: tfex-cosmosdb-account
        resourceGroupName: tfex-cosmosdb-account-rg
Copy

Create Table Resource

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

Constructor syntax

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

@overload
def Table(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          account_name: Optional[str] = None,
          resource_group_name: Optional[str] = None,
          autoscale_settings: Optional[TableAutoscaleSettingsArgs] = None,
          name: Optional[str] = None,
          throughput: Optional[int] = None)
func NewTable(ctx *Context, name string, args TableArgs, opts ...ResourceOption) (*Table, error)
public Table(string name, TableArgs args, CustomResourceOptions? opts = null)
public Table(String name, TableArgs args)
public Table(String name, TableArgs args, CustomResourceOptions options)
type: azure:cosmosdb:Table
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. TableArgs
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. TableArgs
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. TableArgs
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. TableArgs
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. TableArgs
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 tableResource = new Azure.CosmosDB.Table("tableResource", new()
{
    AccountName = "string",
    ResourceGroupName = "string",
    AutoscaleSettings = new Azure.CosmosDB.Inputs.TableAutoscaleSettingsArgs
    {
        MaxThroughput = 0,
    },
    Name = "string",
    Throughput = 0,
});
Copy
example, err := cosmosdb.NewTable(ctx, "tableResource", &cosmosdb.TableArgs{
	AccountName:       pulumi.String("string"),
	ResourceGroupName: pulumi.String("string"),
	AutoscaleSettings: &cosmosdb.TableAutoscaleSettingsArgs{
		MaxThroughput: pulumi.Int(0),
	},
	Name:       pulumi.String("string"),
	Throughput: pulumi.Int(0),
})
Copy
var tableResource = new com.pulumi.azure.cosmosdb.Table("tableResource", com.pulumi.azure.cosmosdb.TableArgs.builder()
    .accountName("string")
    .resourceGroupName("string")
    .autoscaleSettings(TableAutoscaleSettingsArgs.builder()
        .maxThroughput(0)
        .build())
    .name("string")
    .throughput(0)
    .build());
Copy
table_resource = azure.cosmosdb.Table("tableResource",
    account_name="string",
    resource_group_name="string",
    autoscale_settings={
        "max_throughput": 0,
    },
    name="string",
    throughput=0)
Copy
const tableResource = new azure.cosmosdb.Table("tableResource", {
    accountName: "string",
    resourceGroupName: "string",
    autoscaleSettings: {
        maxThroughput: 0,
    },
    name: "string",
    throughput: 0,
});
Copy
type: azure:cosmosdb:Table
properties:
    accountName: string
    autoscaleSettings:
        maxThroughput: 0
    name: string
    resourceGroupName: string
    throughput: 0
Copy

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

AccountName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Cosmos DB Table to create the table within. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which the Cosmos DB Table is created. Changing this forces a new resource to be created.
AutoscaleSettings TableAutoscaleSettings

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Note: Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.

Name Changes to this property will trigger replacement. string
Specifies the name of the Cosmos DB Table. Changing this forces a new resource to be created.
Throughput int

The throughput of Table (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.

Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

AccountName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Cosmos DB Table to create the table within. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which the Cosmos DB Table is created. Changing this forces a new resource to be created.
AutoscaleSettings TableAutoscaleSettingsArgs

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Note: Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.

Name Changes to this property will trigger replacement. string
Specifies the name of the Cosmos DB Table. Changing this forces a new resource to be created.
Throughput int

The throughput of Table (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.

Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

accountName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Cosmos DB Table to create the table within. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group in which the Cosmos DB Table is created. Changing this forces a new resource to be created.
autoscaleSettings TableAutoscaleSettings

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Note: Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.

name Changes to this property will trigger replacement. String
Specifies the name of the Cosmos DB Table. Changing this forces a new resource to be created.
throughput Integer

The throughput of Table (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.

Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

accountName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Cosmos DB Table to create the table within. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which the Cosmos DB Table is created. Changing this forces a new resource to be created.
autoscaleSettings TableAutoscaleSettings

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Note: Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.

name Changes to this property will trigger replacement. string
Specifies the name of the Cosmos DB Table. Changing this forces a new resource to be created.
throughput number

The throughput of Table (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.

Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

account_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the Cosmos DB Table to create the table within. Changing this forces a new resource to be created.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the resource group in which the Cosmos DB Table is created. Changing this forces a new resource to be created.
autoscale_settings TableAutoscaleSettingsArgs

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Note: Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.

name Changes to this property will trigger replacement. str
Specifies the name of the Cosmos DB Table. Changing this forces a new resource to be created.
throughput int

The throughput of Table (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.

Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

accountName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Cosmos DB Table to create the table within. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group in which the Cosmos DB Table is created. Changing this forces a new resource to be created.
autoscaleSettings Property Map

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Note: Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.

name Changes to this property will trigger replacement. String
Specifies the name of the Cosmos DB Table. Changing this forces a new resource to be created.
throughput Number

The throughput of Table (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.

Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

Outputs

All input properties are implicitly available as output properties. Additionally, the Table 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 Table Resource

Get an existing Table 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?: TableState, opts?: CustomResourceOptions): Table
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_name: Optional[str] = None,
        autoscale_settings: Optional[TableAutoscaleSettingsArgs] = None,
        name: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        throughput: Optional[int] = None) -> Table
func GetTable(ctx *Context, name string, id IDInput, state *TableState, opts ...ResourceOption) (*Table, error)
public static Table Get(string name, Input<string> id, TableState? state, CustomResourceOptions? opts = null)
public static Table get(String name, Output<String> id, TableState state, CustomResourceOptions options)
resources:  _:    type: azure:cosmosdb:Table    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:
AccountName Changes to this property will trigger replacement. string
The name of the Cosmos DB Table to create the table within. Changing this forces a new resource to be created.
AutoscaleSettings TableAutoscaleSettings

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Note: Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.

Name Changes to this property will trigger replacement. string
Specifies the name of the Cosmos DB Table. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which the Cosmos DB Table is created. Changing this forces a new resource to be created.
Throughput int

The throughput of Table (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.

Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

AccountName Changes to this property will trigger replacement. string
The name of the Cosmos DB Table to create the table within. Changing this forces a new resource to be created.
AutoscaleSettings TableAutoscaleSettingsArgs

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Note: Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.

Name Changes to this property will trigger replacement. string
Specifies the name of the Cosmos DB Table. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which the Cosmos DB Table is created. Changing this forces a new resource to be created.
Throughput int

The throughput of Table (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.

Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

accountName Changes to this property will trigger replacement. String
The name of the Cosmos DB Table to create the table within. Changing this forces a new resource to be created.
autoscaleSettings TableAutoscaleSettings

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Note: Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.

name Changes to this property will trigger replacement. String
Specifies the name of the Cosmos DB Table. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group in which the Cosmos DB Table is created. Changing this forces a new resource to be created.
throughput Integer

The throughput of Table (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.

Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

accountName Changes to this property will trigger replacement. string
The name of the Cosmos DB Table to create the table within. Changing this forces a new resource to be created.
autoscaleSettings TableAutoscaleSettings

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Note: Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.

name Changes to this property will trigger replacement. string
Specifies the name of the Cosmos DB Table. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which the Cosmos DB Table is created. Changing this forces a new resource to be created.
throughput number

The throughput of Table (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.

Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

account_name Changes to this property will trigger replacement. str
The name of the Cosmos DB Table to create the table within. Changing this forces a new resource to be created.
autoscale_settings TableAutoscaleSettingsArgs

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Note: Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.

name Changes to this property will trigger replacement. str
Specifies the name of the Cosmos DB Table. Changing this forces a new resource to be created.
resource_group_name Changes to this property will trigger replacement. str
The name of the resource group in which the Cosmos DB Table is created. Changing this forces a new resource to be created.
throughput int

The throughput of Table (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.

Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

accountName Changes to this property will trigger replacement. String
The name of the Cosmos DB Table to create the table within. Changing this forces a new resource to be created.
autoscaleSettings Property Map

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Note: Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.

name Changes to this property will trigger replacement. String
Specifies the name of the Cosmos DB Table. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group in which the Cosmos DB Table is created. Changing this forces a new resource to be created.
throughput Number

The throughput of Table (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.

Note: throughput has a maximum value of 1000000 unless a higher limit is requested via Azure Support

Supporting Types

TableAutoscaleSettings
, TableAutoscaleSettingsArgs

MaxThroughput int
The maximum throughput of the Table (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.
MaxThroughput int
The maximum throughput of the Table (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.
maxThroughput Integer
The maximum throughput of the Table (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.
maxThroughput number
The maximum throughput of the Table (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.
max_throughput int
The maximum throughput of the Table (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.
maxThroughput Number
The maximum throughput of the Table (RU/s). Must be between 1,000 and 1,000,000. Must be set in increments of 1,000. Conflicts with throughput.

Import

CosmosDB Tables can be imported using the resource id, e.g.

$ pulumi import azure:cosmosdb/table:Table table1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/account1/tables/table1
Copy

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.