ServerTransparentDataEncryption

class ServerTransparentDataEncryption : KotlinCustomResource

Manages the transparent data encryption configuration for a MSSQL Server !>IMPORTANT: This resource is obsolete and should only be used on pre-existing MS SQL Instances that are over 2 years old. By default all new MS SQL Instances are deployed with System Managed Transparent Data Encryption enabled.

NOTE: Once transparent data encryption is enabled on a MS SQL instance, it is not possible to remove TDE. You will be able to switch between 'ServiceManaged' and 'CustomerManaged' keys, but will not be able to remove encryption. For safety when this resource is deleted, the TDE mode will automatically be set to 'ServiceManaged'. See key_vault_uri for more information on how to specify the key types. As SQL Server only supports a single configuration for encryption settings, this resource will replace the current encryption settings on the server. Note: See documentation for important information on how handle lifecycle management of the keys to prevent data lockout.

Example Usage

With Service Managed Key

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.mssql.Server;
import com.pulumi.azure.mssql.ServerArgs;
import com.pulumi.azure.mssql.inputs.ServerAzureadAdministratorArgs;
import com.pulumi.azure.mssql.ServerTransparentDataEncryption;
import com.pulumi.azure.mssql.ServerTransparentDataEncryptionArgs;
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("EastUs")
.build());
var exampleServer = new Server("exampleServer", ServerArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.version("12.0")
.administratorLogin("missadministrator")
.administratorLoginPassword("thisIsKat11")
.minimumTlsVersion("1.2")
.azureadAdministrator(ServerAzureadAdministratorArgs.builder()
.loginUsername("AzureAD Admin")
.objectId("00000000-0000-0000-0000-000000000000")
.build())
.tags(Map.of("environment", "production"))
.build());
var exampleServerTransparentDataEncryption = new ServerTransparentDataEncryption("exampleServerTransparentDataEncryption", ServerTransparentDataEncryptionArgs.builder()
.serverId(exampleServer.id())
.build());
}
}

With Customer Managed Key

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.CoreFunctions;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.mssql.Server;
import com.pulumi.azure.mssql.ServerArgs;
import com.pulumi.azure.mssql.inputs.ServerAzureadAdministratorArgs;
import com.pulumi.azure.mssql.inputs.ServerIdentityArgs;
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.ServerTransparentDataEncryption;
import com.pulumi.azure.mssql.ServerTransparentDataEncryptionArgs;
import com.pulumi.resources.CustomResourceOptions;
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 current = CoreFunctions.getClientConfig();
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("EastUs")
.build());
var exampleServer = new Server("exampleServer", ServerArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.version("12.0")
.administratorLogin("missadministrator")
.administratorLoginPassword("thisIsKat11")
.minimumTlsVersion("1.2")
.azureadAdministrator(ServerAzureadAdministratorArgs.builder()
.loginUsername("AzureAD Admin")
.objectId("00000000-0000-0000-0000-000000000000")
.build())
.tags(Map.of("environment", "production"))
.identity(ServerIdentityArgs.builder()
.type("SystemAssigned")
.build())
.build());
var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.enabledForDiskEncryption(true)
.tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
.softDeleteRetentionDays(7)
.purgeProtectionEnabled(false)
.skuName("standard")
.accessPolicies(
KeyVaultAccessPolicyArgs.builder()
.tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
.objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
.keyPermissions(
"Get",
"List",
"Create",
"Delete",
"Update",
"Recover",
"Purge",
"GetRotationPolicy")
.build(),
KeyVaultAccessPolicyArgs.builder()
.tenantId(exampleServer.identity().applyValue(identity -> identity.tenantId()))
.objectId(exampleServer.identity().applyValue(identity -> identity.principalId()))
.keyPermissions(
"Get",
"WrapKey",
"UnwrapKey")
.build())
.build());
var exampleKey = new Key("exampleKey", KeyArgs.builder()
.keyVaultId(exampleKeyVault.id())
.keyType("RSA")
.keySize(2048)
.keyOpts(
"unwrapKey",
"wrapKey")
.build(), CustomResourceOptions.builder()
.dependsOn(exampleKeyVault)
.build());
var exampleServerTransparentDataEncryption = new ServerTransparentDataEncryption("exampleServerTransparentDataEncryption", ServerTransparentDataEncryptionArgs.builder()
.serverId(exampleServer.id())
.keyVaultKeyId(exampleKey.id())
.build());
}
}

Import

SQL Server Transparent Data Encryption can be imported using the resource id, e.g.

$ pulumi import azure:mssql/serverTransparentDataEncryption:ServerTransparentDataEncryption example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/encryptionProtector/current

Properties

Link copied to clipboard

When enabled, the server will continuously check the key vault for any new versions of the key being used as the TDE protector. If a new version of the key is detected, the TDE protector on the server will be automatically rotated to the latest key version within 60 minutes.

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

To use customer managed keys from Azure Key Vault, provide the AKV Key ID. To use service managed keys, omit this field.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val serverId: Output<String>

Specifies the name of the MS SQL Server. Changing this forces a new resource to be created.

Link copied to clipboard
val urn: Output<String>