Database

class Database : KotlinCustomResource

Manages a MS SQL Database.

Example Usage

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.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.mssql.Server;
import com.pulumi.azure.mssql.ServerArgs;
import com.pulumi.azure.mssql.Database;
import com.pulumi.azure.mssql.DatabaseArgs;
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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.accountTier("Standard")
.accountReplicationType("LRS")
.build());
var exampleServer = new Server("exampleServer", ServerArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.version("12.0")
.administratorLogin("4dm1n157r470r")
.administratorLoginPassword("4-v3ry-53cr37-p455w0rd")
.build());
var test = new Database("test", DatabaseArgs.builder()
.serverId(exampleServer.id())
.collation("SQL_Latin1_General_CP1_CI_AS")
.licenseType("LicenseIncluded")
.maxSizeGb(4)
.readScale(true)
.skuName("S0")
.zoneRedundant(true)
.tags(Map.of("foo", "bar"))
.build());
}
}

Import

SQL Database can be imported using the resource id, e.g.

$ pulumi import azure:mssql/database:Database example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/example1

Properties

Link copied to clipboard

Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. This property is only settable for General Purpose Serverless databases.

Link copied to clipboard
val collation: Output<String>

Specifies the collation of the database. Changing this forces a new resource to be created.

Link copied to clipboard
val createMode: Output<String>?

The create mode of the database. Possible values are Copy, Default, OnlineSecondary, PointInTimeRestore, Recovery, Restore, RestoreExternalBackup, RestoreExternalBackupSecondary, RestoreLongTermRetentionBackup and Secondary. Mutually exclusive with import. Changing this forces a new resource to be created.

Link copied to clipboard

The ID of the source database from which to create the new database. This should only be used for databases with create_mode values that use another database as reference. Changing this forces a new resource to be created.

Link copied to clipboard
val elasticPoolId: Output<String>?

Specifies the ID of the elastic pool containing this database.

Link copied to clipboard

A boolean that specifies if the Geo Backup Policy is enabled. Defaults to true.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val import: Output<DatabaseImport>?

A Database Import block as documented below. Mutually exclusive with create_mode.

Link copied to clipboard
val ledgerEnabled: Output<Boolean>

A boolean that specifies if this is a ledger database. Defaults to false. Changing this forces a new resource to be created.

Link copied to clipboard
val licenseType: Output<String>

Specifies the license type applied to this database. Possible values are LicenseIncluded and BasePrice.

Link copied to clipboard

A long_term_retention_policy block as defined below.

Link copied to clipboard

The name of the Public Maintenance Configuration window to apply to the database. Valid values include SQL_Default, SQL_EastUS_DB_1, SQL_EastUS2_DB_1, SQL_SoutheastAsia_DB_1, SQL_AustraliaEast_DB_1, SQL_NorthEurope_DB_1, SQL_SouthCentralUS_DB_1, SQL_WestUS2_DB_1, SQL_UKSouth_DB_1, SQL_WestEurope_DB_1, SQL_EastUS_DB_2, SQL_EastUS2_DB_2, SQL_WestUS2_DB_2, SQL_SoutheastAsia_DB_2, SQL_AustraliaEast_DB_2, SQL_NorthEurope_DB_2, SQL_SouthCentralUS_DB_2, SQL_UKSouth_DB_2, SQL_WestEurope_DB_2, SQL_AustraliaSoutheast_DB_1, SQL_BrazilSouth_DB_1, SQL_CanadaCentral_DB_1, SQL_CanadaEast_DB_1, SQL_CentralUS_DB_1, SQL_EastAsia_DB_1, SQL_FranceCentral_DB_1, SQL_GermanyWestCentral_DB_1, SQL_CentralIndia_DB_1, SQL_SouthIndia_DB_1, SQL_JapanEast_DB_1, SQL_JapanWest_DB_1, SQL_NorthCentralUS_DB_1, SQL_UKWest_DB_1, SQL_WestUS_DB_1, SQL_AustraliaSoutheast_DB_2, SQL_BrazilSouth_DB_2, SQL_CanadaCentral_DB_2, SQL_CanadaEast_DB_2, SQL_CentralUS_DB_2, SQL_EastAsia_DB_2, SQL_FranceCentral_DB_2, SQL_GermanyWestCentral_DB_2, SQL_CentralIndia_DB_2, SQL_SouthIndia_DB_2, SQL_JapanEast_DB_2, SQL_JapanWest_DB_2, SQL_NorthCentralUS_DB_2, SQL_UKWest_DB_2, SQL_WestUS_DB_2, SQL_WestCentralUS_DB_1, SQL_FranceSouth_DB_1, SQL_WestCentralUS_DB_2, SQL_FranceSouth_DB_2, SQL_SwitzerlandNorth_DB_1, SQL_SwitzerlandNorth_DB_2, SQL_BrazilSoutheast_DB_1, SQL_UAENorth_DB_1, SQL_BrazilSoutheast_DB_2, SQL_UAENorth_DB_2. Defaults to SQL_Default.

Link copied to clipboard
val maxSizeGb: Output<Int>

The max size of the database in gigabytes.

Link copied to clipboard
val minCapacity: Output<Double>

Minimal capacity that database will always have allocated, if not paused. This property is only settable for General Purpose Serverless databases.

Link copied to clipboard
val name: Output<String>

The name of the MS SQL Database. Changing this forces a new resource to be created.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val readReplicaCount: Output<Int>

The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed. This property is only settable for Hyperscale edition databases.

Link copied to clipboard
val readScale: Output<Boolean>

If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases.

Link copied to clipboard

The ID of the database to be recovered. This property is only applicable when the create_mode is Recovery.

Link copied to clipboard

The ID of the database to be restored. This property is only applicable when the create_mode is Restore.

Link copied to clipboard

Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. This property is only settable for create_mode= PointInTimeRestore databases.

Link copied to clipboard
val sampleName: Output<String>

Specifies the name of the sample schema to apply when creating this database. Possible value is AdventureWorksLT.

Link copied to clipboard
val serverId: Output<String>

The id of the MS SQL Server on which to create the database. Changing this forces a new resource to be created.

Link copied to clipboard

A short_term_retention_policy block as defined below.

Link copied to clipboard
val skuName: Output<String>

Specifies the name of the SKU used by the database. For example, GP_S_Gen5_2,HS_Gen4_1,BC_Gen5_2, ElasticPool, Basic,S0, P2 ,DW100c, DS100. Changing this from the HyperScale service tier to another service tier will create a new resource.

Link copied to clipboard

Specifies the storage account type used to store backups for this database. Possible values are Geo, Local and Zone. The default value is Geo.

Link copied to clipboard
val tags: Output<Map<String, String>>?

A mapping of tags to assign to the resource.

Link copied to clipboard

Threat detection policy configuration. The threat_detection_policy block supports fields documented below.

Link copied to clipboard

If set to true, Transparent Data Encryption will be enabled on the database. Defaults to true.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val zoneRedundant: Output<Boolean>

Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. This property is only settable for Premium and Business Critical databases.