1. Packages
  2. Azure Classic
  3. API Docs
  4. mssql
  5. ServerTransparentDataEncryption

We recommend using Azure Native.

Azure Classic v5.73.0 published on Monday, Apr 22, 2024 by Pulumi

azure.mssql.ServerTransparentDataEncryption

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.73.0 published on Monday, Apr 22, 2024 by Pulumi

    Manages the transparent data encryption configuration for a MSSQL Server

    !> IMPORTANT: This resource should only be used with pre-existing MS SQL Instances that are over 2 years old. For new MS SQL Instances that will be created through the use of the azure.mssql.Server resource, please enable Transparent Data Encryption through azure.mssql.Server resource itself by configuring an identity block. 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

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "EastUs",
    });
    const exampleServer = new azure.mssql.Server("example", {
        name: "mssqlserver",
        resourceGroupName: example.name,
        location: example.location,
        version: "12.0",
        administratorLogin: "missadministrator",
        administratorLoginPassword: "thisIsKat11",
        minimumTlsVersion: "1.2",
        azureadAdministrator: {
            loginUsername: "AzureAD Admin",
            objectId: "00000000-0000-0000-0000-000000000000",
        },
        tags: {
            environment: "production",
        },
    });
    const exampleServerTransparentDataEncryption = new azure.mssql.ServerTransparentDataEncryption("example", {serverId: exampleServer.id});
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="EastUs")
    example_server = azure.mssql.Server("example",
        name="mssqlserver",
        resource_group_name=example.name,
        location=example.location,
        version="12.0",
        administrator_login="missadministrator",
        administrator_login_password="thisIsKat11",
        minimum_tls_version="1.2",
        azuread_administrator=azure.mssql.ServerAzureadAdministratorArgs(
            login_username="AzureAD Admin",
            object_id="00000000-0000-0000-0000-000000000000",
        ),
        tags={
            "environment": "production",
        })
    example_server_transparent_data_encryption = azure.mssql.ServerTransparentDataEncryption("example", server_id=example_server.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mssql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("EastUs"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleServer, err := mssql.NewServer(ctx, "example", &mssql.ServerArgs{
    			Name:                       pulumi.String("mssqlserver"),
    			ResourceGroupName:          example.Name,
    			Location:                   example.Location,
    			Version:                    pulumi.String("12.0"),
    			AdministratorLogin:         pulumi.String("missadministrator"),
    			AdministratorLoginPassword: pulumi.String("thisIsKat11"),
    			MinimumTlsVersion:          pulumi.String("1.2"),
    			AzureadAdministrator: &mssql.ServerAzureadAdministratorArgs{
    				LoginUsername: pulumi.String("AzureAD Admin"),
    				ObjectId:      pulumi.String("00000000-0000-0000-0000-000000000000"),
    			},
    			Tags: pulumi.StringMap{
    				"environment": pulumi.String("production"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = mssql.NewServerTransparentDataEncryption(ctx, "example", &mssql.ServerTransparentDataEncryptionArgs{
    			ServerId: exampleServer.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "EastUs",
        });
    
        var exampleServer = new Azure.MSSql.Server("example", new()
        {
            Name = "mssqlserver",
            ResourceGroupName = example.Name,
            Location = example.Location,
            Version = "12.0",
            AdministratorLogin = "missadministrator",
            AdministratorLoginPassword = "thisIsKat11",
            MinimumTlsVersion = "1.2",
            AzureadAdministrator = new Azure.MSSql.Inputs.ServerAzureadAdministratorArgs
            {
                LoginUsername = "AzureAD Admin",
                ObjectId = "00000000-0000-0000-0000-000000000000",
            },
            Tags = 
            {
                { "environment", "production" },
            },
        });
    
        var exampleServerTransparentDataEncryption = new Azure.MSSql.ServerTransparentDataEncryption("example", new()
        {
            ServerId = exampleServer.Id,
        });
    
    });
    
    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 example = new ResourceGroup("example", ResourceGroupArgs.builder()        
                .name("example-resources")
                .location("EastUs")
                .build());
    
            var exampleServer = new Server("exampleServer", ServerArgs.builder()        
                .name("mssqlserver")
                .resourceGroupName(example.name())
                .location(example.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());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: EastUs
      exampleServer:
        type: azure:mssql:Server
        name: example
        properties:
          name: mssqlserver
          resourceGroupName: ${example.name}
          location: ${example.location}
          version: '12.0'
          administratorLogin: missadministrator
          administratorLoginPassword: thisIsKat11
          minimumTlsVersion: '1.2'
          azureadAdministrator:
            loginUsername: AzureAD Admin
            objectId: 00000000-0000-0000-0000-000000000000
          tags:
            environment: production
      exampleServerTransparentDataEncryption:
        type: azure:mssql:ServerTransparentDataEncryption
        name: example
        properties:
          serverId: ${exampleServer.id}
    

    With Customer Managed Key

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const current = azure.core.getClientConfig({});
    const example = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "EastUs",
    });
    const exampleServer = new azure.mssql.Server("example", {
        name: "mssqlserver",
        resourceGroupName: example.name,
        location: example.location,
        version: "12.0",
        administratorLogin: "missadministrator",
        administratorLoginPassword: "thisIsKat11",
        minimumTlsVersion: "1.2",
        azureadAdministrator: {
            loginUsername: "AzureAD Admin",
            objectId: "00000000-0000-0000-0000-000000000000",
        },
        tags: {
            environment: "production",
        },
        identity: {
            type: "SystemAssigned",
        },
    });
    // Create a key vault with policies for the deployer to create a key & SQL Server to wrap/unwrap/get key
    const exampleKeyVault = new azure.keyvault.KeyVault("example", {
        name: "example",
        location: example.location,
        resourceGroupName: example.name,
        enabledForDiskEncryption: true,
        tenantId: current.then(current => current.tenantId),
        softDeleteRetentionDays: 7,
        purgeProtectionEnabled: false,
        skuName: "standard",
        accessPolicies: [
            {
                tenantId: current.then(current => current.tenantId),
                objectId: current.then(current => current.objectId),
                keyPermissions: [
                    "Get",
                    "List",
                    "Create",
                    "Delete",
                    "Update",
                    "Recover",
                    "Purge",
                    "GetRotationPolicy",
                ],
            },
            {
                tenantId: exampleServer.identity.apply(identity => identity?.tenantId),
                objectId: exampleServer.identity.apply(identity => identity?.principalId),
                keyPermissions: [
                    "Get",
                    "WrapKey",
                    "UnwrapKey",
                ],
            },
        ],
    });
    const exampleKey = new azure.keyvault.Key("example", {
        name: "byok",
        keyVaultId: exampleKeyVault.id,
        keyType: "RSA",
        keySize: 2048,
        keyOpts: [
            "unwrapKey",
            "wrapKey",
        ],
    });
    const exampleServerTransparentDataEncryption = new azure.mssql.ServerTransparentDataEncryption("example", {
        serverId: exampleServer.id,
        keyVaultKeyId: exampleKey.id,
    });
    
    import pulumi
    import pulumi_azure as azure
    
    current = azure.core.get_client_config()
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="EastUs")
    example_server = azure.mssql.Server("example",
        name="mssqlserver",
        resource_group_name=example.name,
        location=example.location,
        version="12.0",
        administrator_login="missadministrator",
        administrator_login_password="thisIsKat11",
        minimum_tls_version="1.2",
        azuread_administrator=azure.mssql.ServerAzureadAdministratorArgs(
            login_username="AzureAD Admin",
            object_id="00000000-0000-0000-0000-000000000000",
        ),
        tags={
            "environment": "production",
        },
        identity=azure.mssql.ServerIdentityArgs(
            type="SystemAssigned",
        ))
    # Create a key vault with policies for the deployer to create a key & SQL Server to wrap/unwrap/get key
    example_key_vault = azure.keyvault.KeyVault("example",
        name="example",
        location=example.location,
        resource_group_name=example.name,
        enabled_for_disk_encryption=True,
        tenant_id=current.tenant_id,
        soft_delete_retention_days=7,
        purge_protection_enabled=False,
        sku_name="standard",
        access_policies=[
            azure.keyvault.KeyVaultAccessPolicyArgs(
                tenant_id=current.tenant_id,
                object_id=current.object_id,
                key_permissions=[
                    "Get",
                    "List",
                    "Create",
                    "Delete",
                    "Update",
                    "Recover",
                    "Purge",
                    "GetRotationPolicy",
                ],
            ),
            azure.keyvault.KeyVaultAccessPolicyArgs(
                tenant_id=example_server.identity.tenant_id,
                object_id=example_server.identity.principal_id,
                key_permissions=[
                    "Get",
                    "WrapKey",
                    "UnwrapKey",
                ],
            ),
        ])
    example_key = azure.keyvault.Key("example",
        name="byok",
        key_vault_id=example_key_vault.id,
        key_type="RSA",
        key_size=2048,
        key_opts=[
            "unwrapKey",
            "wrapKey",
        ])
    example_server_transparent_data_encryption = azure.mssql.ServerTransparentDataEncryption("example",
        server_id=example_server.id,
        key_vault_key_id=example_key.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/keyvault"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mssql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		current, err := core.GetClientConfig(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("EastUs"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleServer, err := mssql.NewServer(ctx, "example", &mssql.ServerArgs{
    			Name:                       pulumi.String("mssqlserver"),
    			ResourceGroupName:          example.Name,
    			Location:                   example.Location,
    			Version:                    pulumi.String("12.0"),
    			AdministratorLogin:         pulumi.String("missadministrator"),
    			AdministratorLoginPassword: pulumi.String("thisIsKat11"),
    			MinimumTlsVersion:          pulumi.String("1.2"),
    			AzureadAdministrator: &mssql.ServerAzureadAdministratorArgs{
    				LoginUsername: pulumi.String("AzureAD Admin"),
    				ObjectId:      pulumi.String("00000000-0000-0000-0000-000000000000"),
    			},
    			Tags: pulumi.StringMap{
    				"environment": pulumi.String("production"),
    			},
    			Identity: &mssql.ServerIdentityArgs{
    				Type: pulumi.String("SystemAssigned"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// Create a key vault with policies for the deployer to create a key & SQL Server to wrap/unwrap/get key
    		exampleKeyVault, err := keyvault.NewKeyVault(ctx, "example", &keyvault.KeyVaultArgs{
    			Name:                     pulumi.String("example"),
    			Location:                 example.Location,
    			ResourceGroupName:        example.Name,
    			EnabledForDiskEncryption: pulumi.Bool(true),
    			TenantId:                 pulumi.String(current.TenantId),
    			SoftDeleteRetentionDays:  pulumi.Int(7),
    			PurgeProtectionEnabled:   pulumi.Bool(false),
    			SkuName:                  pulumi.String("standard"),
    			AccessPolicies: keyvault.KeyVaultAccessPolicyArray{
    				&keyvault.KeyVaultAccessPolicyArgs{
    					TenantId: pulumi.String(current.TenantId),
    					ObjectId: pulumi.String(current.ObjectId),
    					KeyPermissions: pulumi.StringArray{
    						pulumi.String("Get"),
    						pulumi.String("List"),
    						pulumi.String("Create"),
    						pulumi.String("Delete"),
    						pulumi.String("Update"),
    						pulumi.String("Recover"),
    						pulumi.String("Purge"),
    						pulumi.String("GetRotationPolicy"),
    					},
    				},
    				&keyvault.KeyVaultAccessPolicyArgs{
    					TenantId: exampleServer.Identity.ApplyT(func(identity mssql.ServerIdentity) (*string, error) {
    						return &identity.TenantId, nil
    					}).(pulumi.StringPtrOutput),
    					ObjectId: exampleServer.Identity.ApplyT(func(identity mssql.ServerIdentity) (*string, error) {
    						return &identity.PrincipalId, nil
    					}).(pulumi.StringPtrOutput),
    					KeyPermissions: pulumi.StringArray{
    						pulumi.String("Get"),
    						pulumi.String("WrapKey"),
    						pulumi.String("UnwrapKey"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleKey, err := keyvault.NewKey(ctx, "example", &keyvault.KeyArgs{
    			Name:       pulumi.String("byok"),
    			KeyVaultId: exampleKeyVault.ID(),
    			KeyType:    pulumi.String("RSA"),
    			KeySize:    pulumi.Int(2048),
    			KeyOpts: pulumi.StringArray{
    				pulumi.String("unwrapKey"),
    				pulumi.String("wrapKey"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = mssql.NewServerTransparentDataEncryption(ctx, "example", &mssql.ServerTransparentDataEncryptionArgs{
    			ServerId:      exampleServer.ID(),
    			KeyVaultKeyId: exampleKey.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var current = Azure.Core.GetClientConfig.Invoke();
    
        var example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "EastUs",
        });
    
        var exampleServer = new Azure.MSSql.Server("example", new()
        {
            Name = "mssqlserver",
            ResourceGroupName = example.Name,
            Location = example.Location,
            Version = "12.0",
            AdministratorLogin = "missadministrator",
            AdministratorLoginPassword = "thisIsKat11",
            MinimumTlsVersion = "1.2",
            AzureadAdministrator = new Azure.MSSql.Inputs.ServerAzureadAdministratorArgs
            {
                LoginUsername = "AzureAD Admin",
                ObjectId = "00000000-0000-0000-0000-000000000000",
            },
            Tags = 
            {
                { "environment", "production" },
            },
            Identity = new Azure.MSSql.Inputs.ServerIdentityArgs
            {
                Type = "SystemAssigned",
            },
        });
    
        // Create a key vault with policies for the deployer to create a key & SQL Server to wrap/unwrap/get key
        var exampleKeyVault = new Azure.KeyVault.KeyVault("example", new()
        {
            Name = "example",
            Location = example.Location,
            ResourceGroupName = example.Name,
            EnabledForDiskEncryption = true,
            TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
            SoftDeleteRetentionDays = 7,
            PurgeProtectionEnabled = false,
            SkuName = "standard",
            AccessPolicies = new[]
            {
                new Azure.KeyVault.Inputs.KeyVaultAccessPolicyArgs
                {
                    TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
                    ObjectId = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
                    KeyPermissions = new[]
                    {
                        "Get",
                        "List",
                        "Create",
                        "Delete",
                        "Update",
                        "Recover",
                        "Purge",
                        "GetRotationPolicy",
                    },
                },
                new Azure.KeyVault.Inputs.KeyVaultAccessPolicyArgs
                {
                    TenantId = exampleServer.Identity.Apply(identity => identity?.TenantId),
                    ObjectId = exampleServer.Identity.Apply(identity => identity?.PrincipalId),
                    KeyPermissions = new[]
                    {
                        "Get",
                        "WrapKey",
                        "UnwrapKey",
                    },
                },
            },
        });
    
        var exampleKey = new Azure.KeyVault.Key("example", new()
        {
            Name = "byok",
            KeyVaultId = exampleKeyVault.Id,
            KeyType = "RSA",
            KeySize = 2048,
            KeyOpts = new[]
            {
                "unwrapKey",
                "wrapKey",
            },
        });
    
        var exampleServerTransparentDataEncryption = new Azure.MSSql.ServerTransparentDataEncryption("example", new()
        {
            ServerId = exampleServer.Id,
            KeyVaultKeyId = exampleKey.Id,
        });
    
    });
    
    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 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()        
                .name("example-resources")
                .location("EastUs")
                .build());
    
            var exampleServer = new Server("exampleServer", ServerArgs.builder()        
                .name("mssqlserver")
                .resourceGroupName(example.name())
                .location(example.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());
    
            // Create a key vault with policies for the deployer to create a key & SQL Server to wrap/unwrap/get key
            var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()        
                .name("example")
                .location(example.location())
                .resourceGroupName(example.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()        
                .name("byok")
                .keyVaultId(exampleKeyVault.id())
                .keyType("RSA")
                .keySize(2048)
                .keyOpts(            
                    "unwrapKey",
                    "wrapKey")
                .build());
    
            var exampleServerTransparentDataEncryption = new ServerTransparentDataEncryption("exampleServerTransparentDataEncryption", ServerTransparentDataEncryptionArgs.builder()        
                .serverId(exampleServer.id())
                .keyVaultKeyId(exampleKey.id())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: EastUs
      exampleServer:
        type: azure:mssql:Server
        name: example
        properties:
          name: mssqlserver
          resourceGroupName: ${example.name}
          location: ${example.location}
          version: '12.0'
          administratorLogin: missadministrator
          administratorLoginPassword: thisIsKat11
          minimumTlsVersion: '1.2'
          azureadAdministrator:
            loginUsername: AzureAD Admin
            objectId: 00000000-0000-0000-0000-000000000000
          tags:
            environment: production
          identity:
            type: SystemAssigned
      # Create a key vault with policies for the deployer to create a key & SQL Server to wrap/unwrap/get key
      exampleKeyVault:
        type: azure:keyvault:KeyVault
        name: example
        properties:
          name: example
          location: ${example.location}
          resourceGroupName: ${example.name}
          enabledForDiskEncryption: true
          tenantId: ${current.tenantId}
          softDeleteRetentionDays: 7
          purgeProtectionEnabled: false
          skuName: standard
          accessPolicies:
            - tenantId: ${current.tenantId}
              objectId: ${current.objectId}
              keyPermissions:
                - Get
                - List
                - Create
                - Delete
                - Update
                - Recover
                - Purge
                - GetRotationPolicy
            - tenantId: ${exampleServer.identity.tenantId}
              objectId: ${exampleServer.identity.principalId}
              keyPermissions:
                - Get
                - WrapKey
                - UnwrapKey
      exampleKey:
        type: azure:keyvault:Key
        name: example
        properties:
          name: byok
          keyVaultId: ${exampleKeyVault.id}
          keyType: RSA
          keySize: 2048
          keyOpts:
            - unwrapKey
            - wrapKey
      exampleServerTransparentDataEncryption:
        type: azure:mssql:ServerTransparentDataEncryption
        name: example
        properties:
          serverId: ${exampleServer.id}
          keyVaultKeyId: ${exampleKey.id}
    variables:
      current:
        fn::invoke:
          Function: azure:core:getClientConfig
          Arguments: {}
    

    Create ServerTransparentDataEncryption Resource

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

    Constructor syntax

    new ServerTransparentDataEncryption(name: string, args: ServerTransparentDataEncryptionArgs, opts?: CustomResourceOptions);
    @overload
    def ServerTransparentDataEncryption(resource_name: str,
                                        args: ServerTransparentDataEncryptionArgs,
                                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServerTransparentDataEncryption(resource_name: str,
                                        opts: Optional[ResourceOptions] = None,
                                        server_id: Optional[str] = None,
                                        auto_rotation_enabled: Optional[bool] = None,
                                        key_vault_key_id: Optional[str] = None)
    func NewServerTransparentDataEncryption(ctx *Context, name string, args ServerTransparentDataEncryptionArgs, opts ...ResourceOption) (*ServerTransparentDataEncryption, error)
    public ServerTransparentDataEncryption(string name, ServerTransparentDataEncryptionArgs args, CustomResourceOptions? opts = null)
    public ServerTransparentDataEncryption(String name, ServerTransparentDataEncryptionArgs args)
    public ServerTransparentDataEncryption(String name, ServerTransparentDataEncryptionArgs args, CustomResourceOptions options)
    
    type: azure:mssql:ServerTransparentDataEncryption
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ServerTransparentDataEncryptionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ServerTransparentDataEncryptionArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ServerTransparentDataEncryptionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServerTransparentDataEncryptionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServerTransparentDataEncryptionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var serverTransparentDataEncryptionResource = new Azure.MSSql.ServerTransparentDataEncryption("serverTransparentDataEncryptionResource", new()
    {
        ServerId = "string",
        AutoRotationEnabled = false,
        KeyVaultKeyId = "string",
    });
    
    example, err := mssql.NewServerTransparentDataEncryption(ctx, "serverTransparentDataEncryptionResource", &mssql.ServerTransparentDataEncryptionArgs{
    	ServerId:            pulumi.String("string"),
    	AutoRotationEnabled: pulumi.Bool(false),
    	KeyVaultKeyId:       pulumi.String("string"),
    })
    
    var serverTransparentDataEncryptionResource = new ServerTransparentDataEncryption("serverTransparentDataEncryptionResource", ServerTransparentDataEncryptionArgs.builder()        
        .serverId("string")
        .autoRotationEnabled(false)
        .keyVaultKeyId("string")
        .build());
    
    server_transparent_data_encryption_resource = azure.mssql.ServerTransparentDataEncryption("serverTransparentDataEncryptionResource",
        server_id="string",
        auto_rotation_enabled=False,
        key_vault_key_id="string")
    
    const serverTransparentDataEncryptionResource = new azure.mssql.ServerTransparentDataEncryption("serverTransparentDataEncryptionResource", {
        serverId: "string",
        autoRotationEnabled: false,
        keyVaultKeyId: "string",
    });
    
    type: azure:mssql:ServerTransparentDataEncryption
    properties:
        autoRotationEnabled: false
        keyVaultKeyId: string
        serverId: string
    

    ServerTransparentDataEncryption Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ServerTransparentDataEncryption resource accepts the following input properties:

    ServerId string
    Specifies the name of the MS SQL Server. Changing this forces a new resource to be created.
    AutoRotationEnabled bool
    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.
    KeyVaultKeyId string

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

    NOTE: In order to use customer managed keys, the identity of the MSSQL server must have the following permissions on the key vault: 'get', 'wrapKey' and 'unwrapKey'

    NOTE: If server_id denotes a secondary server deployed for disaster recovery purposes, then the key_vault_key_id should be the same key used for the primary server's transparent data encryption. Both primary and secondary servers should be encrypted with same key material.

    ServerId string
    Specifies the name of the MS SQL Server. Changing this forces a new resource to be created.
    AutoRotationEnabled bool
    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.
    KeyVaultKeyId string

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

    NOTE: In order to use customer managed keys, the identity of the MSSQL server must have the following permissions on the key vault: 'get', 'wrapKey' and 'unwrapKey'

    NOTE: If server_id denotes a secondary server deployed for disaster recovery purposes, then the key_vault_key_id should be the same key used for the primary server's transparent data encryption. Both primary and secondary servers should be encrypted with same key material.

    serverId String
    Specifies the name of the MS SQL Server. Changing this forces a new resource to be created.
    autoRotationEnabled Boolean
    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.
    keyVaultKeyId String

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

    NOTE: In order to use customer managed keys, the identity of the MSSQL server must have the following permissions on the key vault: 'get', 'wrapKey' and 'unwrapKey'

    NOTE: If server_id denotes a secondary server deployed for disaster recovery purposes, then the key_vault_key_id should be the same key used for the primary server's transparent data encryption. Both primary and secondary servers should be encrypted with same key material.

    serverId string
    Specifies the name of the MS SQL Server. Changing this forces a new resource to be created.
    autoRotationEnabled boolean
    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.
    keyVaultKeyId string

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

    NOTE: In order to use customer managed keys, the identity of the MSSQL server must have the following permissions on the key vault: 'get', 'wrapKey' and 'unwrapKey'

    NOTE: If server_id denotes a secondary server deployed for disaster recovery purposes, then the key_vault_key_id should be the same key used for the primary server's transparent data encryption. Both primary and secondary servers should be encrypted with same key material.

    server_id str
    Specifies the name of the MS SQL Server. Changing this forces a new resource to be created.
    auto_rotation_enabled bool
    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.
    key_vault_key_id str

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

    NOTE: In order to use customer managed keys, the identity of the MSSQL server must have the following permissions on the key vault: 'get', 'wrapKey' and 'unwrapKey'

    NOTE: If server_id denotes a secondary server deployed for disaster recovery purposes, then the key_vault_key_id should be the same key used for the primary server's transparent data encryption. Both primary and secondary servers should be encrypted with same key material.

    serverId String
    Specifies the name of the MS SQL Server. Changing this forces a new resource to be created.
    autoRotationEnabled Boolean
    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.
    keyVaultKeyId String

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

    NOTE: In order to use customer managed keys, the identity of the MSSQL server must have the following permissions on the key vault: 'get', 'wrapKey' and 'unwrapKey'

    NOTE: If server_id denotes a secondary server deployed for disaster recovery purposes, then the key_vault_key_id should be the same key used for the primary server's transparent data encryption. Both primary and secondary servers should be encrypted with same key material.

    Outputs

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

    Get an existing ServerTransparentDataEncryption 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?: ServerTransparentDataEncryptionState, opts?: CustomResourceOptions): ServerTransparentDataEncryption
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            auto_rotation_enabled: Optional[bool] = None,
            key_vault_key_id: Optional[str] = None,
            server_id: Optional[str] = None) -> ServerTransparentDataEncryption
    func GetServerTransparentDataEncryption(ctx *Context, name string, id IDInput, state *ServerTransparentDataEncryptionState, opts ...ResourceOption) (*ServerTransparentDataEncryption, error)
    public static ServerTransparentDataEncryption Get(string name, Input<string> id, ServerTransparentDataEncryptionState? state, CustomResourceOptions? opts = null)
    public static ServerTransparentDataEncryption get(String name, Output<String> id, ServerTransparentDataEncryptionState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    AutoRotationEnabled bool
    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.
    KeyVaultKeyId string

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

    NOTE: In order to use customer managed keys, the identity of the MSSQL server must have the following permissions on the key vault: 'get', 'wrapKey' and 'unwrapKey'

    NOTE: If server_id denotes a secondary server deployed for disaster recovery purposes, then the key_vault_key_id should be the same key used for the primary server's transparent data encryption. Both primary and secondary servers should be encrypted with same key material.

    ServerId string
    Specifies the name of the MS SQL Server. Changing this forces a new resource to be created.
    AutoRotationEnabled bool
    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.
    KeyVaultKeyId string

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

    NOTE: In order to use customer managed keys, the identity of the MSSQL server must have the following permissions on the key vault: 'get', 'wrapKey' and 'unwrapKey'

    NOTE: If server_id denotes a secondary server deployed for disaster recovery purposes, then the key_vault_key_id should be the same key used for the primary server's transparent data encryption. Both primary and secondary servers should be encrypted with same key material.

    ServerId string
    Specifies the name of the MS SQL Server. Changing this forces a new resource to be created.
    autoRotationEnabled Boolean
    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.
    keyVaultKeyId String

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

    NOTE: In order to use customer managed keys, the identity of the MSSQL server must have the following permissions on the key vault: 'get', 'wrapKey' and 'unwrapKey'

    NOTE: If server_id denotes a secondary server deployed for disaster recovery purposes, then the key_vault_key_id should be the same key used for the primary server's transparent data encryption. Both primary and secondary servers should be encrypted with same key material.

    serverId String
    Specifies the name of the MS SQL Server. Changing this forces a new resource to be created.
    autoRotationEnabled boolean
    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.
    keyVaultKeyId string

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

    NOTE: In order to use customer managed keys, the identity of the MSSQL server must have the following permissions on the key vault: 'get', 'wrapKey' and 'unwrapKey'

    NOTE: If server_id denotes a secondary server deployed for disaster recovery purposes, then the key_vault_key_id should be the same key used for the primary server's transparent data encryption. Both primary and secondary servers should be encrypted with same key material.

    serverId string
    Specifies the name of the MS SQL Server. Changing this forces a new resource to be created.
    auto_rotation_enabled bool
    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.
    key_vault_key_id str

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

    NOTE: In order to use customer managed keys, the identity of the MSSQL server must have the following permissions on the key vault: 'get', 'wrapKey' and 'unwrapKey'

    NOTE: If server_id denotes a secondary server deployed for disaster recovery purposes, then the key_vault_key_id should be the same key used for the primary server's transparent data encryption. Both primary and secondary servers should be encrypted with same key material.

    server_id str
    Specifies the name of the MS SQL Server. Changing this forces a new resource to be created.
    autoRotationEnabled Boolean
    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.
    keyVaultKeyId String

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

    NOTE: In order to use customer managed keys, the identity of the MSSQL server must have the following permissions on the key vault: 'get', 'wrapKey' and 'unwrapKey'

    NOTE: If server_id denotes a secondary server deployed for disaster recovery purposes, then the key_vault_key_id should be the same key used for the primary server's transparent data encryption. Both primary and secondary servers should be encrypted with same key material.

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

    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
    

    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.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.73.0 published on Monday, Apr 22, 2024 by Pulumi