DatabaseArgs

data class DatabaseArgs(val autoPauseDelayInMinutes: Output<Int>? = null, val collation: Output<String>? = null, val createMode: Output<String>? = null, val creationSourceDatabaseId: Output<String>? = null, val elasticPoolId: Output<String>? = null, val enclaveType: Output<String>? = null, val geoBackupEnabled: Output<Boolean>? = null, val identity: Output<DatabaseIdentityArgs>? = null, val import: Output<DatabaseImportArgs>? = null, val ledgerEnabled: Output<Boolean>? = null, val licenseType: Output<String>? = null, val longTermRetentionPolicy: Output<DatabaseLongTermRetentionPolicyArgs>? = null, val maintenanceConfigurationName: Output<String>? = null, val maxSizeGb: Output<Int>? = null, val minCapacity: Output<Double>? = null, val name: Output<String>? = null, val readReplicaCount: Output<Int>? = null, val readScale: Output<Boolean>? = null, val recoverDatabaseId: Output<String>? = null, val recoveryPointId: Output<String>? = null, val restoreDroppedDatabaseId: Output<String>? = null, val restoreLongTermRetentionBackupId: Output<String>? = null, val restorePointInTime: Output<String>? = null, val sampleName: Output<String>? = null, val serverId: Output<String>? = null, val shortTermRetentionPolicy: Output<DatabaseShortTermRetentionPolicyArgs>? = null, val skuName: Output<String>? = null, val storageAccountType: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val threatDetectionPolicy: Output<DatabaseThreatDetectionPolicyArgs>? = null, val transparentDataEncryptionEnabled: Output<Boolean>? = null, val transparentDataEncryptionKeyAutomaticRotationEnabled: Output<Boolean>? = null, val transparentDataEncryptionKeyVaultKeyId: Output<String>? = null, val zoneRedundant: Output<Boolean>? = null) : ConvertibleToJava<DatabaseArgs>

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

Transparent Data Encryption(TDE) With A Customer Managed Key(CMK) During Create

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.authorization.UserAssignedIdentity;
import com.pulumi.azure.authorization.UserAssignedIdentityArgs;
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.keyvault.KeyVault;
import com.pulumi.azure.keyvault.KeyVaultArgs;
import com.pulumi.azure.keyvault.inputs.KeyVaultAccessPolicyArgs;
import com.pulumi.azure.keyvault.Key;
import com.pulumi.azure.keyvault.KeyArgs;
import com.pulumi.azure.mssql.Database;
import com.pulumi.azure.mssql.DatabaseArgs;
import com.pulumi.azure.mssql.inputs.DatabaseIdentityArgs;
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 exampleUserAssignedIdentity = new UserAssignedIdentity("exampleUserAssignedIdentity", UserAssignedIdentityArgs.builder()
.name("example-admin")
.location(example.location())
.resourceGroupName(example.name())
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.name("examplesa")
.resourceGroupName(example.name())
.location(example.location())
.accountTier("Standard")
.accountReplicationType("LRS")
.build());
var exampleServer = new Server("exampleServer", ServerArgs.builder()
.name("example-sqlserver")
.resourceGroupName(example.name())
.location(example.location())
.version("12.0")
.administratorLogin("4dm1n157r470r")
.administratorLoginPassword("4-v3ry-53cr37-p455w0rd")
.build());
var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
.name("mssqltdeexample")
.location(example.location())
.resourceGroupName(example.name())
.enabledForDiskEncryption(true)
.tenantId(exampleUserAssignedIdentity.tenantId())
.softDeleteRetentionDays(7)
.purgeProtectionEnabled(true)
.skuName("standard")
.accessPolicies(
KeyVaultAccessPolicyArgs.builder()
.tenantId(current.tenantId())
.objectId(current.objectId())
.keyPermissions(
"Get",
"List",
"Create",
"Delete",
"Update",
"Recover",
"Purge",
"GetRotationPolicy")
.build(),
KeyVaultAccessPolicyArgs.builder()
.tenantId(exampleUserAssignedIdentity.tenantId())
.objectId(exampleUserAssignedIdentity.principalId())
.keyPermissions(
"Get",
"WrapKey",
"UnwrapKey")
.build())
.build());
var exampleKey = new Key("exampleKey", KeyArgs.builder()
.name("example-key")
.keyVaultId(exampleKeyVault.id())
.keyType("RSA")
.keySize(2048)
.keyOpts(
"unwrapKey",
"wrapKey")
.build());
var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
.name("example-db")
.serverId(exampleServer.id())
.collation("SQL_Latin1_General_CP1_CI_AS")
.licenseType("LicenseIncluded")
.maxSizeGb(4)
.readScale(true)
.skuName("S0")
.zoneRedundant(true)
.enclaveType("VBS")
.tags(Map.of("foo", "bar"))
.identity(DatabaseIdentityArgs.builder()
.type("UserAssigned")
.identityIds(exampleUserAssignedIdentity.id())
.build())
.transparentDataEncryptionKeyVaultKeyId(exampleKey.id())
.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

Constructors

Link copied to clipboard
fun DatabaseArgs(autoPauseDelayInMinutes: Output<Int>? = null, collation: Output<String>? = null, createMode: Output<String>? = null, creationSourceDatabaseId: Output<String>? = null, elasticPoolId: Output<String>? = null, enclaveType: Output<String>? = null, geoBackupEnabled: Output<Boolean>? = null, identity: Output<DatabaseIdentityArgs>? = null, import: Output<DatabaseImportArgs>? = null, ledgerEnabled: Output<Boolean>? = null, licenseType: Output<String>? = null, longTermRetentionPolicy: Output<DatabaseLongTermRetentionPolicyArgs>? = null, maintenanceConfigurationName: Output<String>? = null, maxSizeGb: Output<Int>? = null, minCapacity: Output<Double>? = null, name: Output<String>? = null, readReplicaCount: Output<Int>? = null, readScale: Output<Boolean>? = null, recoverDatabaseId: Output<String>? = null, recoveryPointId: Output<String>? = null, restoreDroppedDatabaseId: Output<String>? = null, restoreLongTermRetentionBackupId: Output<String>? = null, restorePointInTime: Output<String>? = null, sampleName: Output<String>? = null, serverId: Output<String>? = null, shortTermRetentionPolicy: Output<DatabaseShortTermRetentionPolicyArgs>? = null, skuName: Output<String>? = null, storageAccountType: Output<String>? = null, tags: Output<Map<String, String>>? = null, threatDetectionPolicy: Output<DatabaseThreatDetectionPolicyArgs>? = null, transparentDataEncryptionEnabled: Output<Boolean>? = null, transparentDataEncryptionKeyAutomaticRotationEnabled: Output<Boolean>? = null, transparentDataEncryptionKeyVaultKeyId: Output<String>? = null, zoneRedundant: Output<Boolean>? = null)

Functions

Link copied to clipboard
open override fun toJava(): DatabaseArgs

Properties

Link copied to clipboard
val autoPauseDelayInMinutes: Output<Int>? = null

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 Serverless databases.

Link copied to clipboard
val collation: Output<String>? = null

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

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

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. Defaults to Default.

Link copied to clipboard
val creationSourceDatabaseId: Output<String>? = null

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>? = null

Specifies the ID of the elastic pool containing this database.

Link copied to clipboard
val enclaveType: Output<String>? = null

Specifies the type of enclave to be used by the database. Possible value VBS.

Link copied to clipboard
val geoBackupEnabled: Output<Boolean>? = null

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

Link copied to clipboard
val identity: Output<DatabaseIdentityArgs>? = null

An identity block as defined below.

Link copied to clipboard
val import: Output<DatabaseImportArgs>? = null

A import block as documented below. Mutually exclusive with create_mode.

Link copied to clipboard
val ledgerEnabled: Output<Boolean>? = null

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>? = null

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>? = null

The max size of the database in gigabytes.

Link copied to clipboard
val minCapacity: Output<Double>? = null

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

Link copied to clipboard
val name: Output<String>? = null

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

Link copied to clipboard
val readReplicaCount: Output<Int>? = null

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>? = null

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
val recoverDatabaseId: Output<String>? = null

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

Link copied to clipboard
val recoveryPointId: Output<String>? = null

The ID of the Recovery Services Recovery Point Id to be restored. This property is only applicable when the create_mode is Recovery.

Link copied to clipboard
val restoreDroppedDatabaseId: Output<String>? = null

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

Link copied to clipboard

The ID of the long term retention backup to be restored. This property is only applicable when the create_mode is RestoreLongTermRetentionBackup.

Link copied to clipboard
val restorePointInTime: Output<String>? = null

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>? = null

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>? = null

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>? = null

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
val storageAccountType: Output<String>? = null

Specifies the storage account type used to store backups for this database. Possible values are Geo, GeoZone, Local and Zone. Defaults to Geo.

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

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.

Boolean flag to specify whether TDE automatically rotates the encryption Key to latest version or not. Possible values are true or false. Defaults to false.

Link copied to clipboard

The fully versioned Key Vault Key URL (e.g. 'https://<YourVaultName>.vault.azure.net/keys/<YourKeyName>/<YourKeyVersion>) to be used as the Customer Managed Key(CMK/BYOK) for the Transparent Data Encryption(TDE) layer.

Link copied to clipboard
val zoneRedundant: Output<Boolean>? = null

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.