1. Packages
  2. Azure Native
  3. API Docs
  4. cosmosdb
  5. DatabaseAccountSqlDatabase
This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.2.0 published on Monday, Apr 14, 2025 by Pulumi

azure-native.cosmosdb.DatabaseAccountSqlDatabase

Explore with Pulumi AI

This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.2.0 published on Monday, Apr 14, 2025 by Pulumi

An Azure Cosmos DB SQL database.

Uses Azure REST API version 2016-03-31.

Other available API versions: 2015-04-01, 2015-04-08, 2015-11-06, 2016-03-19. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native cosmosdb [ApiVersion]. See the version guide for details.

Example Usage

CosmosDBSqlDatabaseCreateUpdate

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var databaseAccountSqlDatabase = new AzureNative.CosmosDB.DatabaseAccountSqlDatabase("databaseAccountSqlDatabase", new()
    {
        AccountName = "ddb1",
        DatabaseName = "databaseName",
        Options = null,
        Resource = new AzureNative.CosmosDB.Inputs.SqlDatabaseResourceArgs
        {
            Id = "databaseName",
        },
        ResourceGroupName = "rg1",
    });

});
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cosmosdb.NewDatabaseAccountSqlDatabase(ctx, "databaseAccountSqlDatabase", &cosmosdb.DatabaseAccountSqlDatabaseArgs{
			AccountName:  pulumi.String("ddb1"),
			DatabaseName: pulumi.String("databaseName"),
			Options:      pulumi.StringMap{},
			Resource: &cosmosdb.SqlDatabaseResourceArgs{
				Id: pulumi.String("databaseName"),
			},
			ResourceGroupName: pulumi.String("rg1"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.cosmosdb.DatabaseAccountSqlDatabase;
import com.pulumi.azurenative.cosmosdb.DatabaseAccountSqlDatabaseArgs;
import com.pulumi.azurenative.cosmosdb.inputs.SqlDatabaseResourceArgs;
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 databaseAccountSqlDatabase = new DatabaseAccountSqlDatabase("databaseAccountSqlDatabase", DatabaseAccountSqlDatabaseArgs.builder()
            .accountName("ddb1")
            .databaseName("databaseName")
            .options(Map.ofEntries(
            ))
            .resource(SqlDatabaseResourceArgs.builder()
                .id("databaseName")
                .build())
            .resourceGroupName("rg1")
            .build());

    }
}
Copy
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const databaseAccountSqlDatabase = new azure_native.cosmosdb.DatabaseAccountSqlDatabase("databaseAccountSqlDatabase", {
    accountName: "ddb1",
    databaseName: "databaseName",
    options: {},
    resource: {
        id: "databaseName",
    },
    resourceGroupName: "rg1",
});
Copy
import pulumi
import pulumi_azure_native as azure_native

database_account_sql_database = azure_native.cosmosdb.DatabaseAccountSqlDatabase("databaseAccountSqlDatabase",
    account_name="ddb1",
    database_name="databaseName",
    options={},
    resource={
        "id": "databaseName",
    },
    resource_group_name="rg1")
Copy
resources:
  databaseAccountSqlDatabase:
    type: azure-native:cosmosdb:DatabaseAccountSqlDatabase
    properties:
      accountName: ddb1
      databaseName: databaseName
      options: {}
      resource:
        id: databaseName
      resourceGroupName: rg1
Copy

Create DatabaseAccountSqlDatabase Resource

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

Constructor syntax

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

@overload
def DatabaseAccountSqlDatabase(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               account_name: Optional[str] = None,
                               options: Optional[Mapping[str, str]] = None,
                               resource: Optional[SqlDatabaseResourceArgs] = None,
                               resource_group_name: Optional[str] = None,
                               database_name: Optional[str] = None)
func NewDatabaseAccountSqlDatabase(ctx *Context, name string, args DatabaseAccountSqlDatabaseArgs, opts ...ResourceOption) (*DatabaseAccountSqlDatabase, error)
public DatabaseAccountSqlDatabase(string name, DatabaseAccountSqlDatabaseArgs args, CustomResourceOptions? opts = null)
public DatabaseAccountSqlDatabase(String name, DatabaseAccountSqlDatabaseArgs args)
public DatabaseAccountSqlDatabase(String name, DatabaseAccountSqlDatabaseArgs args, CustomResourceOptions options)
type: azure-native:cosmosdb:DatabaseAccountSqlDatabase
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. DatabaseAccountSqlDatabaseArgs
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. DatabaseAccountSqlDatabaseArgs
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. DatabaseAccountSqlDatabaseArgs
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. DatabaseAccountSqlDatabaseArgs
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. DatabaseAccountSqlDatabaseArgs
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 databaseAccountSqlDatabaseResource = new AzureNative.CosmosDB.DatabaseAccountSqlDatabase("databaseAccountSqlDatabaseResource", new()
{
    AccountName = "string",
    Options = 
    {
        { "string", "string" },
    },
    Resource = new AzureNative.CosmosDB.Inputs.SqlDatabaseResourceArgs
    {
        Id = "string",
        CreateMode = "string",
        RestoreParameters = new AzureNative.CosmosDB.Inputs.ResourceRestoreParametersArgs
        {
            RestoreSource = "string",
            RestoreTimestampInUtc = "string",
            RestoreWithTtlDisabled = false,
        },
    },
    ResourceGroupName = "string",
    DatabaseName = "string",
});
Copy
example, err := cosmosdb.NewDatabaseAccountSqlDatabase(ctx, "databaseAccountSqlDatabaseResource", &cosmosdb.DatabaseAccountSqlDatabaseArgs{
	AccountName: pulumi.String("string"),
	Options: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Resource: &cosmosdb.SqlDatabaseResourceArgs{
		Id:         pulumi.String("string"),
		CreateMode: pulumi.String("string"),
		RestoreParameters: &cosmosdb.ResourceRestoreParametersArgs{
			RestoreSource:          pulumi.String("string"),
			RestoreTimestampInUtc:  pulumi.String("string"),
			RestoreWithTtlDisabled: pulumi.Bool(false),
		},
	},
	ResourceGroupName: pulumi.String("string"),
	DatabaseName:      pulumi.String("string"),
})
Copy
var databaseAccountSqlDatabaseResource = new DatabaseAccountSqlDatabase("databaseAccountSqlDatabaseResource", DatabaseAccountSqlDatabaseArgs.builder()
    .accountName("string")
    .options(Map.of("string", "string"))
    .resource(SqlDatabaseResourceArgs.builder()
        .id("string")
        .createMode("string")
        .restoreParameters(ResourceRestoreParametersArgs.builder()
            .restoreSource("string")
            .restoreTimestampInUtc("string")
            .restoreWithTtlDisabled(false)
            .build())
        .build())
    .resourceGroupName("string")
    .databaseName("string")
    .build());
Copy
database_account_sql_database_resource = azure_native.cosmosdb.DatabaseAccountSqlDatabase("databaseAccountSqlDatabaseResource",
    account_name="string",
    options={
        "string": "string",
    },
    resource={
        "id": "string",
        "create_mode": "string",
        "restore_parameters": {
            "restore_source": "string",
            "restore_timestamp_in_utc": "string",
            "restore_with_ttl_disabled": False,
        },
    },
    resource_group_name="string",
    database_name="string")
Copy
const databaseAccountSqlDatabaseResource = new azure_native.cosmosdb.DatabaseAccountSqlDatabase("databaseAccountSqlDatabaseResource", {
    accountName: "string",
    options: {
        string: "string",
    },
    resource: {
        id: "string",
        createMode: "string",
        restoreParameters: {
            restoreSource: "string",
            restoreTimestampInUtc: "string",
            restoreWithTtlDisabled: false,
        },
    },
    resourceGroupName: "string",
    databaseName: "string",
});
Copy
type: azure-native:cosmosdb:DatabaseAccountSqlDatabase
properties:
    accountName: string
    databaseName: string
    options:
        string: string
    resource:
        createMode: string
        id: string
        restoreParameters:
            restoreSource: string
            restoreTimestampInUtc: string
            restoreWithTtlDisabled: false
    resourceGroupName: string
Copy

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

AccountName
This property is required.
Changes to this property will trigger replacement.
string
Cosmos DB database account name.
Options This property is required. Dictionary<string, string>
A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request.
Resource This property is required. Pulumi.AzureNative.CosmosDB.Inputs.SqlDatabaseResource
The standard JSON format of a SQL database
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
Name of an Azure resource group.
DatabaseName Changes to this property will trigger replacement. string
Cosmos DB database name.
AccountName
This property is required.
Changes to this property will trigger replacement.
string
Cosmos DB database account name.
Options This property is required. map[string]string
A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request.
Resource This property is required. SqlDatabaseResourceArgs
The standard JSON format of a SQL database
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
Name of an Azure resource group.
DatabaseName Changes to this property will trigger replacement. string
Cosmos DB database name.
accountName
This property is required.
Changes to this property will trigger replacement.
String
Cosmos DB database account name.
options This property is required. Map<String,String>
A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request.
resource This property is required. SqlDatabaseResource
The standard JSON format of a SQL database
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
Name of an Azure resource group.
databaseName Changes to this property will trigger replacement. String
Cosmos DB database name.
accountName
This property is required.
Changes to this property will trigger replacement.
string
Cosmos DB database account name.
options This property is required. {[key: string]: string}
A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request.
resource This property is required. SqlDatabaseResource
The standard JSON format of a SQL database
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
Name of an Azure resource group.
databaseName Changes to this property will trigger replacement. string
Cosmos DB database name.
account_name
This property is required.
Changes to this property will trigger replacement.
str
Cosmos DB database account name.
options This property is required. Mapping[str, str]
A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request.
resource This property is required. SqlDatabaseResourceArgs
The standard JSON format of a SQL database
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
Name of an Azure resource group.
database_name Changes to this property will trigger replacement. str
Cosmos DB database name.
accountName
This property is required.
Changes to this property will trigger replacement.
String
Cosmos DB database account name.
options This property is required. Map<String>
A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request.
resource This property is required. Property Map
The standard JSON format of a SQL database
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
Name of an Azure resource group.
databaseName Changes to this property will trigger replacement. String
Cosmos DB database name.

Outputs

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

AzureApiVersion string
The Azure API version of the resource.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the database account.
Type string
The type of Azure resource.
Colls string
A system generated property that specified the addressable path of the collections resource.
Etag string
A system generated property representing the resource etag required for optimistic concurrency control.
Location string
The location of the resource group to which the resource belongs.
Rid string
A system generated property. A unique identifier.
Tags Dictionary<string, string>
Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB".
Ts object
A system generated property that denotes the last updated timestamp of the resource.
Users string
A system generated property that specifies the addressable path of the users resource.
AzureApiVersion string
The Azure API version of the resource.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the database account.
Type string
The type of Azure resource.
Colls string
A system generated property that specified the addressable path of the collections resource.
Etag string
A system generated property representing the resource etag required for optimistic concurrency control.
Location string
The location of the resource group to which the resource belongs.
Rid string
A system generated property. A unique identifier.
Tags map[string]string
Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB".
Ts interface{}
A system generated property that denotes the last updated timestamp of the resource.
Users string
A system generated property that specifies the addressable path of the users resource.
azureApiVersion String
The Azure API version of the resource.
id String
The provider-assigned unique ID for this managed resource.
name String
The name of the database account.
type String
The type of Azure resource.
colls String
A system generated property that specified the addressable path of the collections resource.
etag String
A system generated property representing the resource etag required for optimistic concurrency control.
location String
The location of the resource group to which the resource belongs.
rid String
A system generated property. A unique identifier.
tags Map<String,String>
Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB".
ts Object
A system generated property that denotes the last updated timestamp of the resource.
users String
A system generated property that specifies the addressable path of the users resource.
azureApiVersion string
The Azure API version of the resource.
id string
The provider-assigned unique ID for this managed resource.
name string
The name of the database account.
type string
The type of Azure resource.
colls string
A system generated property that specified the addressable path of the collections resource.
etag string
A system generated property representing the resource etag required for optimistic concurrency control.
location string
The location of the resource group to which the resource belongs.
rid string
A system generated property. A unique identifier.
tags {[key: string]: string}
Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB".
ts any
A system generated property that denotes the last updated timestamp of the resource.
users string
A system generated property that specifies the addressable path of the users resource.
azure_api_version str
The Azure API version of the resource.
id str
The provider-assigned unique ID for this managed resource.
name str
The name of the database account.
type str
The type of Azure resource.
colls str
A system generated property that specified the addressable path of the collections resource.
etag str
A system generated property representing the resource etag required for optimistic concurrency control.
location str
The location of the resource group to which the resource belongs.
rid str
A system generated property. A unique identifier.
tags Mapping[str, str]
Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB".
ts Any
A system generated property that denotes the last updated timestamp of the resource.
users str
A system generated property that specifies the addressable path of the users resource.
azureApiVersion String
The Azure API version of the resource.
id String
The provider-assigned unique ID for this managed resource.
name String
The name of the database account.
type String
The type of Azure resource.
colls String
A system generated property that specified the addressable path of the collections resource.
etag String
A system generated property representing the resource etag required for optimistic concurrency control.
location String
The location of the resource group to which the resource belongs.
rid String
A system generated property. A unique identifier.
tags Map<String>
Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB".
ts Any
A system generated property that denotes the last updated timestamp of the resource.
users String
A system generated property that specifies the addressable path of the users resource.

Supporting Types

CreateMode
, CreateModeArgs

Default
Default
Restore
Restore
CreateModeDefault
Default
CreateModeRestore
Restore
Default
Default
Restore
Restore
Default
Default
Restore
Restore
DEFAULT
Default
RESTORE
Restore
"Default"
Default
"Restore"
Restore

ResourceRestoreParameters
, ResourceRestoreParametersArgs

RestoreSource string
The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}
RestoreTimestampInUtc string
Time to which the account has to be restored (ISO-8601 format).
RestoreWithTtlDisabled bool
Specifies whether the restored account will have Time-To-Live disabled upon the successful restore.
RestoreSource string
The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}
RestoreTimestampInUtc string
Time to which the account has to be restored (ISO-8601 format).
RestoreWithTtlDisabled bool
Specifies whether the restored account will have Time-To-Live disabled upon the successful restore.
restoreSource String
The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}
restoreTimestampInUtc String
Time to which the account has to be restored (ISO-8601 format).
restoreWithTtlDisabled Boolean
Specifies whether the restored account will have Time-To-Live disabled upon the successful restore.
restoreSource string
The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}
restoreTimestampInUtc string
Time to which the account has to be restored (ISO-8601 format).
restoreWithTtlDisabled boolean
Specifies whether the restored account will have Time-To-Live disabled upon the successful restore.
restore_source str
The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}
restore_timestamp_in_utc str
Time to which the account has to be restored (ISO-8601 format).
restore_with_ttl_disabled bool
Specifies whether the restored account will have Time-To-Live disabled upon the successful restore.
restoreSource String
The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}
restoreTimestampInUtc String
Time to which the account has to be restored (ISO-8601 format).
restoreWithTtlDisabled Boolean
Specifies whether the restored account will have Time-To-Live disabled upon the successful restore.

SqlDatabaseResource
, SqlDatabaseResourceArgs

Id This property is required. string
Name of the Cosmos DB SQL database
CreateMode string | Pulumi.AzureNative.CosmosDB.CreateMode
Enum to indicate the mode of resource creation.
RestoreParameters Pulumi.AzureNative.CosmosDB.Inputs.ResourceRestoreParameters
Parameters to indicate the information about the restore
Id This property is required. string
Name of the Cosmos DB SQL database
CreateMode string | CreateMode
Enum to indicate the mode of resource creation.
RestoreParameters ResourceRestoreParameters
Parameters to indicate the information about the restore
id This property is required. String
Name of the Cosmos DB SQL database
createMode String | CreateMode
Enum to indicate the mode of resource creation.
restoreParameters ResourceRestoreParameters
Parameters to indicate the information about the restore
id This property is required. string
Name of the Cosmos DB SQL database
createMode string | CreateMode
Enum to indicate the mode of resource creation.
restoreParameters ResourceRestoreParameters
Parameters to indicate the information about the restore
id This property is required. str
Name of the Cosmos DB SQL database
create_mode str | CreateMode
Enum to indicate the mode of resource creation.
restore_parameters ResourceRestoreParameters
Parameters to indicate the information about the restore
id This property is required. String
Name of the Cosmos DB SQL database
createMode String | "Default" | "Restore"
Enum to indicate the mode of resource creation.
restoreParameters Property Map
Parameters to indicate the information about the restore

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:cosmosdb:DatabaseAccountSqlDatabase databaseName /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/apis/sql/databases/{databaseName} 
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Azure Native pulumi/pulumi-azure-native
License
Apache-2.0
This is the latest version of Azure Native. Use the Azure Native v2 docs if using the v2 version of this package.
Azure Native v3.2.0 published on Monday, Apr 14, 2025 by Pulumi