We recommend using Azure Native.
azure.storage.CustomerManagedKey
Explore with Pulumi AI
Manages a Customer Managed Key for a Storage Account.
NOTE: It’s possible to define a Customer Managed Key both within the
azure.storage.Accountresource via thecustomer_managed_keyblock and by using theazure.storage.CustomerManagedKeyresource. However it’s not possible to use both methods to manage a Customer Managed Key for a Storage Account, since there’ll be conflicts.
Example Usage
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: "West Europe",
});
const exampleKeyVault = new azure.keyvault.KeyVault("example", {
    name: "examplekv",
    location: example.location,
    resourceGroupName: example.name,
    tenantId: current.then(current => current.tenantId),
    skuName: "standard",
    purgeProtectionEnabled: true,
});
const exampleAccount = new azure.storage.Account("example", {
    name: "examplestor",
    resourceGroupName: example.name,
    location: example.location,
    accountTier: "Standard",
    accountReplicationType: "GRS",
    identity: {
        type: "SystemAssigned",
    },
});
const storage = new azure.keyvault.AccessPolicy("storage", {
    keyVaultId: exampleKeyVault.id,
    tenantId: current.then(current => current.tenantId),
    objectId: exampleAccount.identity.apply(identity => identity?.principalId),
    secretPermissions: ["Get"],
    keyPermissions: [
        "Get",
        "UnwrapKey",
        "WrapKey",
    ],
});
const client = new azure.keyvault.AccessPolicy("client", {
    keyVaultId: exampleKeyVault.id,
    tenantId: current.then(current => current.tenantId),
    objectId: current.then(current => current.objectId),
    secretPermissions: ["Get"],
    keyPermissions: [
        "Get",
        "Create",
        "Delete",
        "List",
        "Restore",
        "Recover",
        "UnwrapKey",
        "WrapKey",
        "Purge",
        "Encrypt",
        "Decrypt",
        "Sign",
        "Verify",
        "GetRotationPolicy",
        "SetRotationPolicy",
    ],
});
const exampleKey = new azure.keyvault.Key("example", {
    name: "tfex-key",
    keyVaultId: exampleKeyVault.id,
    keyType: "RSA",
    keySize: 2048,
    keyOpts: [
        "decrypt",
        "encrypt",
        "sign",
        "unwrapKey",
        "verify",
        "wrapKey",
    ],
}, {
    dependsOn: [
        client,
        storage,
    ],
});
const exampleCustomerManagedKey = new azure.storage.CustomerManagedKey("example", {
    storageAccountId: exampleAccount.id,
    keyVaultId: exampleKeyVault.id,
    keyName: exampleKey.name,
});
import pulumi
import pulumi_azure as azure
current = azure.core.get_client_config()
example = azure.core.ResourceGroup("example",
    name="example-resources",
    location="West Europe")
example_key_vault = azure.keyvault.KeyVault("example",
    name="examplekv",
    location=example.location,
    resource_group_name=example.name,
    tenant_id=current.tenant_id,
    sku_name="standard",
    purge_protection_enabled=True)
example_account = azure.storage.Account("example",
    name="examplestor",
    resource_group_name=example.name,
    location=example.location,
    account_tier="Standard",
    account_replication_type="GRS",
    identity={
        "type": "SystemAssigned",
    })
storage = azure.keyvault.AccessPolicy("storage",
    key_vault_id=example_key_vault.id,
    tenant_id=current.tenant_id,
    object_id=example_account.identity.principal_id,
    secret_permissions=["Get"],
    key_permissions=[
        "Get",
        "UnwrapKey",
        "WrapKey",
    ])
client = azure.keyvault.AccessPolicy("client",
    key_vault_id=example_key_vault.id,
    tenant_id=current.tenant_id,
    object_id=current.object_id,
    secret_permissions=["Get"],
    key_permissions=[
        "Get",
        "Create",
        "Delete",
        "List",
        "Restore",
        "Recover",
        "UnwrapKey",
        "WrapKey",
        "Purge",
        "Encrypt",
        "Decrypt",
        "Sign",
        "Verify",
        "GetRotationPolicy",
        "SetRotationPolicy",
    ])
example_key = azure.keyvault.Key("example",
    name="tfex-key",
    key_vault_id=example_key_vault.id,
    key_type="RSA",
    key_size=2048,
    key_opts=[
        "decrypt",
        "encrypt",
        "sign",
        "unwrapKey",
        "verify",
        "wrapKey",
    ],
    opts = pulumi.ResourceOptions(depends_on=[
            client,
            storage,
        ]))
example_customer_managed_key = azure.storage.CustomerManagedKey("example",
    storage_account_id=example_account.id,
    key_vault_id=example_key_vault.id,
    key_name=example_key.name)
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/keyvault"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/storage"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := core.GetClientConfig(ctx, map[string]interface{}{}, nil)
		if err != nil {
			return err
		}
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("example-resources"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleKeyVault, err := keyvault.NewKeyVault(ctx, "example", &keyvault.KeyVaultArgs{
			Name:                   pulumi.String("examplekv"),
			Location:               example.Location,
			ResourceGroupName:      example.Name,
			TenantId:               pulumi.String(current.TenantId),
			SkuName:                pulumi.String("standard"),
			PurgeProtectionEnabled: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
			Name:                   pulumi.String("examplestor"),
			ResourceGroupName:      example.Name,
			Location:               example.Location,
			AccountTier:            pulumi.String("Standard"),
			AccountReplicationType: pulumi.String("GRS"),
			Identity: &storage.AccountIdentityArgs{
				Type: pulumi.String("SystemAssigned"),
			},
		})
		if err != nil {
			return err
		}
		storage, err := keyvault.NewAccessPolicy(ctx, "storage", &keyvault.AccessPolicyArgs{
			KeyVaultId: exampleKeyVault.ID(),
			TenantId:   pulumi.String(current.TenantId),
			ObjectId: pulumi.String(exampleAccount.Identity.ApplyT(func(identity storage.AccountIdentity) (*string, error) {
				return &identity.PrincipalId, nil
			}).(pulumi.StringPtrOutput)),
			SecretPermissions: pulumi.StringArray{
				pulumi.String("Get"),
			},
			KeyPermissions: pulumi.StringArray{
				pulumi.String("Get"),
				pulumi.String("UnwrapKey"),
				pulumi.String("WrapKey"),
			},
		})
		if err != nil {
			return err
		}
		client, err := keyvault.NewAccessPolicy(ctx, "client", &keyvault.AccessPolicyArgs{
			KeyVaultId: exampleKeyVault.ID(),
			TenantId:   pulumi.String(current.TenantId),
			ObjectId:   pulumi.String(current.ObjectId),
			SecretPermissions: pulumi.StringArray{
				pulumi.String("Get"),
			},
			KeyPermissions: pulumi.StringArray{
				pulumi.String("Get"),
				pulumi.String("Create"),
				pulumi.String("Delete"),
				pulumi.String("List"),
				pulumi.String("Restore"),
				pulumi.String("Recover"),
				pulumi.String("UnwrapKey"),
				pulumi.String("WrapKey"),
				pulumi.String("Purge"),
				pulumi.String("Encrypt"),
				pulumi.String("Decrypt"),
				pulumi.String("Sign"),
				pulumi.String("Verify"),
				pulumi.String("GetRotationPolicy"),
				pulumi.String("SetRotationPolicy"),
			},
		})
		if err != nil {
			return err
		}
		exampleKey, err := keyvault.NewKey(ctx, "example", &keyvault.KeyArgs{
			Name:       pulumi.String("tfex-key"),
			KeyVaultId: exampleKeyVault.ID(),
			KeyType:    pulumi.String("RSA"),
			KeySize:    pulumi.Int(2048),
			KeyOpts: pulumi.StringArray{
				pulumi.String("decrypt"),
				pulumi.String("encrypt"),
				pulumi.String("sign"),
				pulumi.String("unwrapKey"),
				pulumi.String("verify"),
				pulumi.String("wrapKey"),
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			client,
			storage,
		}))
		if err != nil {
			return err
		}
		_, err = storage.NewCustomerManagedKey(ctx, "example", &storage.CustomerManagedKeyArgs{
			StorageAccountId: exampleAccount.ID(),
			KeyVaultId:       exampleKeyVault.ID(),
			KeyName:          exampleKey.Name,
		})
		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 = "West Europe",
    });
    var exampleKeyVault = new Azure.KeyVault.KeyVault("example", new()
    {
        Name = "examplekv",
        Location = example.Location,
        ResourceGroupName = example.Name,
        TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
        SkuName = "standard",
        PurgeProtectionEnabled = true,
    });
    var exampleAccount = new Azure.Storage.Account("example", new()
    {
        Name = "examplestor",
        ResourceGroupName = example.Name,
        Location = example.Location,
        AccountTier = "Standard",
        AccountReplicationType = "GRS",
        Identity = new Azure.Storage.Inputs.AccountIdentityArgs
        {
            Type = "SystemAssigned",
        },
    });
    var storage = new Azure.KeyVault.AccessPolicy("storage", new()
    {
        KeyVaultId = exampleKeyVault.Id,
        TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
        ObjectId = exampleAccount.Identity.Apply(identity => identity?.PrincipalId),
        SecretPermissions = new[]
        {
            "Get",
        },
        KeyPermissions = new[]
        {
            "Get",
            "UnwrapKey",
            "WrapKey",
        },
    });
    var client = new Azure.KeyVault.AccessPolicy("client", new()
    {
        KeyVaultId = exampleKeyVault.Id,
        TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
        ObjectId = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
        SecretPermissions = new[]
        {
            "Get",
        },
        KeyPermissions = new[]
        {
            "Get",
            "Create",
            "Delete",
            "List",
            "Restore",
            "Recover",
            "UnwrapKey",
            "WrapKey",
            "Purge",
            "Encrypt",
            "Decrypt",
            "Sign",
            "Verify",
            "GetRotationPolicy",
            "SetRotationPolicy",
        },
    });
    var exampleKey = new Azure.KeyVault.Key("example", new()
    {
        Name = "tfex-key",
        KeyVaultId = exampleKeyVault.Id,
        KeyType = "RSA",
        KeySize = 2048,
        KeyOpts = new[]
        {
            "decrypt",
            "encrypt",
            "sign",
            "unwrapKey",
            "verify",
            "wrapKey",
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            client,
            storage,
        },
    });
    var exampleCustomerManagedKey = new Azure.Storage.CustomerManagedKey("example", new()
    {
        StorageAccountId = exampleAccount.Id,
        KeyVaultId = exampleKeyVault.Id,
        KeyName = exampleKey.Name,
    });
});
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.keyvault.KeyVault;
import com.pulumi.azure.keyvault.KeyVaultArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.storage.inputs.AccountIdentityArgs;
import com.pulumi.azure.keyvault.AccessPolicy;
import com.pulumi.azure.keyvault.AccessPolicyArgs;
import com.pulumi.azure.keyvault.Key;
import com.pulumi.azure.keyvault.KeyArgs;
import com.pulumi.azure.storage.CustomerManagedKey;
import com.pulumi.azure.storage.CustomerManagedKeyArgs;
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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("example-resources")
            .location("West Europe")
            .build());
        var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
            .name("examplekv")
            .location(example.location())
            .resourceGroupName(example.name())
            .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
            .skuName("standard")
            .purgeProtectionEnabled(true)
            .build());
        var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
            .name("examplestor")
            .resourceGroupName(example.name())
            .location(example.location())
            .accountTier("Standard")
            .accountReplicationType("GRS")
            .identity(AccountIdentityArgs.builder()
                .type("SystemAssigned")
                .build())
            .build());
        var storage = new AccessPolicy("storage", AccessPolicyArgs.builder()
            .keyVaultId(exampleKeyVault.id())
            .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
            .objectId(exampleAccount.identity().applyValue(identity -> identity.principalId()))
            .secretPermissions("Get")
            .keyPermissions(            
                "Get",
                "UnwrapKey",
                "WrapKey")
            .build());
        var client = new AccessPolicy("client", AccessPolicyArgs.builder()
            .keyVaultId(exampleKeyVault.id())
            .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
            .objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
            .secretPermissions("Get")
            .keyPermissions(            
                "Get",
                "Create",
                "Delete",
                "List",
                "Restore",
                "Recover",
                "UnwrapKey",
                "WrapKey",
                "Purge",
                "Encrypt",
                "Decrypt",
                "Sign",
                "Verify",
                "GetRotationPolicy",
                "SetRotationPolicy")
            .build());
        var exampleKey = new Key("exampleKey", KeyArgs.builder()
            .name("tfex-key")
            .keyVaultId(exampleKeyVault.id())
            .keyType("RSA")
            .keySize(2048)
            .keyOpts(            
                "decrypt",
                "encrypt",
                "sign",
                "unwrapKey",
                "verify",
                "wrapKey")
            .build(), CustomResourceOptions.builder()
                .dependsOn(                
                    client,
                    storage)
                .build());
        var exampleCustomerManagedKey = new CustomerManagedKey("exampleCustomerManagedKey", CustomerManagedKeyArgs.builder()
            .storageAccountId(exampleAccount.id())
            .keyVaultId(exampleKeyVault.id())
            .keyName(exampleKey.name())
            .build());
    }
}
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  exampleKeyVault:
    type: azure:keyvault:KeyVault
    name: example
    properties:
      name: examplekv
      location: ${example.location}
      resourceGroupName: ${example.name}
      tenantId: ${current.tenantId}
      skuName: standard
      purgeProtectionEnabled: true
  storage:
    type: azure:keyvault:AccessPolicy
    properties:
      keyVaultId: ${exampleKeyVault.id}
      tenantId: ${current.tenantId}
      objectId: ${exampleAccount.identity.principalId}
      secretPermissions:
        - Get
      keyPermissions:
        - Get
        - UnwrapKey
        - WrapKey
  client:
    type: azure:keyvault:AccessPolicy
    properties:
      keyVaultId: ${exampleKeyVault.id}
      tenantId: ${current.tenantId}
      objectId: ${current.objectId}
      secretPermissions:
        - Get
      keyPermissions:
        - Get
        - Create
        - Delete
        - List
        - Restore
        - Recover
        - UnwrapKey
        - WrapKey
        - Purge
        - Encrypt
        - Decrypt
        - Sign
        - Verify
        - GetRotationPolicy
        - SetRotationPolicy
  exampleKey:
    type: azure:keyvault:Key
    name: example
    properties:
      name: tfex-key
      keyVaultId: ${exampleKeyVault.id}
      keyType: RSA
      keySize: 2048
      keyOpts:
        - decrypt
        - encrypt
        - sign
        - unwrapKey
        - verify
        - wrapKey
    options:
      dependsOn:
        - ${client}
        - ${storage}
  exampleAccount:
    type: azure:storage:Account
    name: example
    properties:
      name: examplestor
      resourceGroupName: ${example.name}
      location: ${example.location}
      accountTier: Standard
      accountReplicationType: GRS
      identity:
        type: SystemAssigned
  exampleCustomerManagedKey:
    type: azure:storage:CustomerManagedKey
    name: example
    properties:
      storageAccountId: ${exampleAccount.id}
      keyVaultId: ${exampleKeyVault.id}
      keyName: ${exampleKey.name}
variables:
  current:
    fn::invoke:
      function: azure:core:getClientConfig
      arguments: {}
Create CustomerManagedKey Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CustomerManagedKey(name: string, args: CustomerManagedKeyArgs, opts?: CustomResourceOptions);@overload
def CustomerManagedKey(resource_name: str,
                       args: CustomerManagedKeyArgs,
                       opts: Optional[ResourceOptions] = None)
@overload
def CustomerManagedKey(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       key_name: Optional[str] = None,
                       storage_account_id: Optional[str] = None,
                       federated_identity_client_id: Optional[str] = None,
                       key_vault_id: Optional[str] = None,
                       key_vault_uri: Optional[str] = None,
                       key_version: Optional[str] = None,
                       managed_hsm_key_id: Optional[str] = None,
                       user_assigned_identity_id: Optional[str] = None)func NewCustomerManagedKey(ctx *Context, name string, args CustomerManagedKeyArgs, opts ...ResourceOption) (*CustomerManagedKey, error)public CustomerManagedKey(string name, CustomerManagedKeyArgs args, CustomResourceOptions? opts = null)
public CustomerManagedKey(String name, CustomerManagedKeyArgs args)
public CustomerManagedKey(String name, CustomerManagedKeyArgs args, CustomResourceOptions options)
type: azure:storage:CustomerManagedKey
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 CustomerManagedKeyArgs
- 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 CustomerManagedKeyArgs
- 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 CustomerManagedKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CustomerManagedKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CustomerManagedKeyArgs
- 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 customerManagedKeyResource = new Azure.Storage.CustomerManagedKey("customerManagedKeyResource", new()
{
    KeyName = "string",
    StorageAccountId = "string",
    FederatedIdentityClientId = "string",
    KeyVaultId = "string",
    KeyVaultUri = "string",
    KeyVersion = "string",
    ManagedHsmKeyId = "string",
    UserAssignedIdentityId = "string",
});
example, err := storage.NewCustomerManagedKey(ctx, "customerManagedKeyResource", &storage.CustomerManagedKeyArgs{
	KeyName:                   pulumi.String("string"),
	StorageAccountId:          pulumi.String("string"),
	FederatedIdentityClientId: pulumi.String("string"),
	KeyVaultId:                pulumi.String("string"),
	KeyVaultUri:               pulumi.String("string"),
	KeyVersion:                pulumi.String("string"),
	ManagedHsmKeyId:           pulumi.String("string"),
	UserAssignedIdentityId:    pulumi.String("string"),
})
var customerManagedKeyResource = new CustomerManagedKey("customerManagedKeyResource", CustomerManagedKeyArgs.builder()
    .keyName("string")
    .storageAccountId("string")
    .federatedIdentityClientId("string")
    .keyVaultId("string")
    .keyVaultUri("string")
    .keyVersion("string")
    .managedHsmKeyId("string")
    .userAssignedIdentityId("string")
    .build());
customer_managed_key_resource = azure.storage.CustomerManagedKey("customerManagedKeyResource",
    key_name="string",
    storage_account_id="string",
    federated_identity_client_id="string",
    key_vault_id="string",
    key_vault_uri="string",
    key_version="string",
    managed_hsm_key_id="string",
    user_assigned_identity_id="string")
const customerManagedKeyResource = new azure.storage.CustomerManagedKey("customerManagedKeyResource", {
    keyName: "string",
    storageAccountId: "string",
    federatedIdentityClientId: "string",
    keyVaultId: "string",
    keyVaultUri: "string",
    keyVersion: "string",
    managedHsmKeyId: "string",
    userAssignedIdentityId: "string",
});
type: azure:storage:CustomerManagedKey
properties:
    federatedIdentityClientId: string
    keyName: string
    keyVaultId: string
    keyVaultUri: string
    keyVersion: string
    managedHsmKeyId: string
    storageAccountId: string
    userAssignedIdentityId: string
CustomerManagedKey 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 CustomerManagedKey resource accepts the following input properties:
- KeyName string
- The name of Key Vault Key.
- StorageAccount stringId 
- The ID of the Storage Account. Changing this forces a new resource to be created.
- FederatedIdentity stringClient Id 
- The Client ID of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account.
- KeyVault stringId 
- KeyVault stringUri 
- URI pointing at the Key Vault. Required when using federated_identity_client_id. Exactly one ofmanaged_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- KeyVersion string
- The version of Key Vault Key. Remove or omit this argument to enable Automatic Key Rotation.
- ManagedHsm stringKey Id 
- Key ID of a key in a managed HSM. Exactly one of managed_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- UserAssigned stringIdentity Id 
- The ID of a user assigned identity.
- KeyName string
- The name of Key Vault Key.
- StorageAccount stringId 
- The ID of the Storage Account. Changing this forces a new resource to be created.
- FederatedIdentity stringClient Id 
- The Client ID of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account.
- KeyVault stringId 
- KeyVault stringUri 
- URI pointing at the Key Vault. Required when using federated_identity_client_id. Exactly one ofmanaged_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- KeyVersion string
- The version of Key Vault Key. Remove or omit this argument to enable Automatic Key Rotation.
- ManagedHsm stringKey Id 
- Key ID of a key in a managed HSM. Exactly one of managed_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- UserAssigned stringIdentity Id 
- The ID of a user assigned identity.
- keyName String
- The name of Key Vault Key.
- storageAccount StringId 
- The ID of the Storage Account. Changing this forces a new resource to be created.
- federatedIdentity StringClient Id 
- The Client ID of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account.
- keyVault StringId 
- keyVault StringUri 
- URI pointing at the Key Vault. Required when using federated_identity_client_id. Exactly one ofmanaged_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- keyVersion String
- The version of Key Vault Key. Remove or omit this argument to enable Automatic Key Rotation.
- managedHsm StringKey Id 
- Key ID of a key in a managed HSM. Exactly one of managed_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- userAssigned StringIdentity Id 
- The ID of a user assigned identity.
- keyName string
- The name of Key Vault Key.
- storageAccount stringId 
- The ID of the Storage Account. Changing this forces a new resource to be created.
- federatedIdentity stringClient Id 
- The Client ID of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account.
- keyVault stringId 
- keyVault stringUri 
- URI pointing at the Key Vault. Required when using federated_identity_client_id. Exactly one ofmanaged_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- keyVersion string
- The version of Key Vault Key. Remove or omit this argument to enable Automatic Key Rotation.
- managedHsm stringKey Id 
- Key ID of a key in a managed HSM. Exactly one of managed_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- userAssigned stringIdentity Id 
- The ID of a user assigned identity.
- key_name str
- The name of Key Vault Key.
- storage_account_ strid 
- The ID of the Storage Account. Changing this forces a new resource to be created.
- federated_identity_ strclient_ id 
- The Client ID of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account.
- key_vault_ strid 
- key_vault_ struri 
- URI pointing at the Key Vault. Required when using federated_identity_client_id. Exactly one ofmanaged_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- key_version str
- The version of Key Vault Key. Remove or omit this argument to enable Automatic Key Rotation.
- managed_hsm_ strkey_ id 
- Key ID of a key in a managed HSM. Exactly one of managed_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- user_assigned_ stridentity_ id 
- The ID of a user assigned identity.
- keyName String
- The name of Key Vault Key.
- storageAccount StringId 
- The ID of the Storage Account. Changing this forces a new resource to be created.
- federatedIdentity StringClient Id 
- The Client ID of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account.
- keyVault StringId 
- keyVault StringUri 
- URI pointing at the Key Vault. Required when using federated_identity_client_id. Exactly one ofmanaged_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- keyVersion String
- The version of Key Vault Key. Remove or omit this argument to enable Automatic Key Rotation.
- managedHsm StringKey Id 
- Key ID of a key in a managed HSM. Exactly one of managed_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- userAssigned StringIdentity Id 
- The ID of a user assigned identity.
Outputs
All input properties are implicitly available as output properties. Additionally, the CustomerManagedKey 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 CustomerManagedKey Resource
Get an existing CustomerManagedKey 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?: CustomerManagedKeyState, opts?: CustomResourceOptions): CustomerManagedKey@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        federated_identity_client_id: Optional[str] = None,
        key_name: Optional[str] = None,
        key_vault_id: Optional[str] = None,
        key_vault_uri: Optional[str] = None,
        key_version: Optional[str] = None,
        managed_hsm_key_id: Optional[str] = None,
        storage_account_id: Optional[str] = None,
        user_assigned_identity_id: Optional[str] = None) -> CustomerManagedKeyfunc GetCustomerManagedKey(ctx *Context, name string, id IDInput, state *CustomerManagedKeyState, opts ...ResourceOption) (*CustomerManagedKey, error)public static CustomerManagedKey Get(string name, Input<string> id, CustomerManagedKeyState? state, CustomResourceOptions? opts = null)public static CustomerManagedKey get(String name, Output<String> id, CustomerManagedKeyState state, CustomResourceOptions options)resources:  _:    type: azure:storage:CustomerManagedKey    get:      id: ${id}- 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.
- FederatedIdentity stringClient Id 
- The Client ID of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account.
- KeyName string
- The name of Key Vault Key.
- KeyVault stringId 
- KeyVault stringUri 
- URI pointing at the Key Vault. Required when using federated_identity_client_id. Exactly one ofmanaged_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- KeyVersion string
- The version of Key Vault Key. Remove or omit this argument to enable Automatic Key Rotation.
- ManagedHsm stringKey Id 
- Key ID of a key in a managed HSM. Exactly one of managed_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- StorageAccount stringId 
- The ID of the Storage Account. Changing this forces a new resource to be created.
- UserAssigned stringIdentity Id 
- The ID of a user assigned identity.
- FederatedIdentity stringClient Id 
- The Client ID of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account.
- KeyName string
- The name of Key Vault Key.
- KeyVault stringId 
- KeyVault stringUri 
- URI pointing at the Key Vault. Required when using federated_identity_client_id. Exactly one ofmanaged_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- KeyVersion string
- The version of Key Vault Key. Remove or omit this argument to enable Automatic Key Rotation.
- ManagedHsm stringKey Id 
- Key ID of a key in a managed HSM. Exactly one of managed_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- StorageAccount stringId 
- The ID of the Storage Account. Changing this forces a new resource to be created.
- UserAssigned stringIdentity Id 
- The ID of a user assigned identity.
- federatedIdentity StringClient Id 
- The Client ID of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account.
- keyName String
- The name of Key Vault Key.
- keyVault StringId 
- keyVault StringUri 
- URI pointing at the Key Vault. Required when using federated_identity_client_id. Exactly one ofmanaged_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- keyVersion String
- The version of Key Vault Key. Remove or omit this argument to enable Automatic Key Rotation.
- managedHsm StringKey Id 
- Key ID of a key in a managed HSM. Exactly one of managed_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- storageAccount StringId 
- The ID of the Storage Account. Changing this forces a new resource to be created.
- userAssigned StringIdentity Id 
- The ID of a user assigned identity.
- federatedIdentity stringClient Id 
- The Client ID of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account.
- keyName string
- The name of Key Vault Key.
- keyVault stringId 
- keyVault stringUri 
- URI pointing at the Key Vault. Required when using federated_identity_client_id. Exactly one ofmanaged_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- keyVersion string
- The version of Key Vault Key. Remove or omit this argument to enable Automatic Key Rotation.
- managedHsm stringKey Id 
- Key ID of a key in a managed HSM. Exactly one of managed_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- storageAccount stringId 
- The ID of the Storage Account. Changing this forces a new resource to be created.
- userAssigned stringIdentity Id 
- The ID of a user assigned identity.
- federated_identity_ strclient_ id 
- The Client ID of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account.
- key_name str
- The name of Key Vault Key.
- key_vault_ strid 
- key_vault_ struri 
- URI pointing at the Key Vault. Required when using federated_identity_client_id. Exactly one ofmanaged_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- key_version str
- The version of Key Vault Key. Remove or omit this argument to enable Automatic Key Rotation.
- managed_hsm_ strkey_ id 
- Key ID of a key in a managed HSM. Exactly one of managed_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- storage_account_ strid 
- The ID of the Storage Account. Changing this forces a new resource to be created.
- user_assigned_ stridentity_ id 
- The ID of a user assigned identity.
- federatedIdentity StringClient Id 
- The Client ID of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account.
- keyName String
- The name of Key Vault Key.
- keyVault StringId 
- keyVault StringUri 
- URI pointing at the Key Vault. Required when using federated_identity_client_id. Exactly one ofmanaged_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- keyVersion String
- The version of Key Vault Key. Remove or omit this argument to enable Automatic Key Rotation.
- managedHsm StringKey Id 
- Key ID of a key in a managed HSM. Exactly one of managed_hsm_key_id,key_vault_id, orkey_vault_urimust be specified.
- storageAccount StringId 
- The ID of the Storage Account. Changing this forces a new resource to be created.
- userAssigned StringIdentity Id 
- The ID of a user assigned identity.
Import
Customer Managed Keys for a Storage Account can be imported using the resource id of the Storage Account, e.g.
$ pulumi import azure:storage/customerManagedKey:CustomerManagedKey example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/myaccount
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 azurermTerraform Provider.