Bicep resource definition
The diskEncryptionSets resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
To create a Microsoft.Compute/diskEncryptionSets resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.Compute/diskEncryptionSets@2019-11-01' = {
scope: resourceSymbolicName or scope
identity: {
type: 'string'
}
___location: 'string'
name: 'string'
properties: {
activeKey: {
keyUrl: 'string'
sourceVault: {
id: 'string'
}
}
}
tags: {
{customized property}: 'string'
}
}
Property Values
Microsoft.Compute/diskEncryptionSets
| Name |
Description |
Value |
| identity |
The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. |
EncryptionSetIdentity |
| ___location |
Resource ___location |
string (required) |
| name |
The resource name |
string (required) |
| properties |
|
EncryptionSetProperties |
| scope |
Use when creating a resource at a scope that is different than the deployment scope. |
Set this property to the symbolic name of a resource to apply the extension resource. |
| tags |
Resource tags |
Dictionary of tag names and values. See Tags in templates |
EncryptionSetIdentity
| Name |
Description |
Value |
| type |
The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. |
'SystemAssigned' |
EncryptionSetProperties
| Name |
Description |
Value |
| activeKey |
The key vault key which is currently used by this disk encryption set. |
KeyVaultAndKeyReference |
KeyVaultAndKeyReference
| Name |
Description |
Value |
| keyUrl |
Url pointing to a key or secret in KeyVault |
string (required) |
| sourceVault |
Resource id of the KeyVault containing the key or secret |
SourceVault (required) |
SourceVault
| Name |
Description |
Value |
| id |
Resource Id |
string |
Usage Examples
Azure Verified Modules
The following Azure Verified Modules can be used to deploy this resource type.
ARM template resource definition
The diskEncryptionSets resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
To create a Microsoft.Compute/diskEncryptionSets resource, add the following JSON to your template.
{
"type": "Microsoft.Compute/diskEncryptionSets",
"apiVersion": "2019-11-01",
"name": "string",
"identity": {
"type": "string"
},
"___location": "string",
"properties": {
"activeKey": {
"keyUrl": "string",
"sourceVault": {
"id": "string"
}
}
},
"tags": {
"{customized property}": "string"
}
}
Property Values
Microsoft.Compute/diskEncryptionSets
| Name |
Description |
Value |
| apiVersion |
The api version |
'2019-11-01' |
| identity |
The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. |
EncryptionSetIdentity |
| ___location |
Resource ___location |
string (required) |
| name |
The resource name |
string (required) |
| properties |
|
EncryptionSetProperties |
| tags |
Resource tags |
Dictionary of tag names and values. See Tags in templates |
| type |
The resource type |
'Microsoft.Compute/diskEncryptionSets' |
EncryptionSetIdentity
| Name |
Description |
Value |
| type |
The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. |
'SystemAssigned' |
EncryptionSetProperties
| Name |
Description |
Value |
| activeKey |
The key vault key which is currently used by this disk encryption set. |
KeyVaultAndKeyReference |
KeyVaultAndKeyReference
| Name |
Description |
Value |
| keyUrl |
Url pointing to a key or secret in KeyVault |
string (required) |
| sourceVault |
Resource id of the KeyVault containing the key or secret |
SourceVault (required) |
SourceVault
| Name |
Description |
Value |
| id |
Resource Id |
string |
Usage Examples
The diskEncryptionSets resource type can be deployed with operations that target:
For a list of changed properties in each API version, see change log.
To create a Microsoft.Compute/diskEncryptionSets resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Compute/diskEncryptionSets@2019-11-01"
name = "string"
parent_id = "string"
identity {
type = "string"
identity_ids = [
"string"
]
}
___location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
activeKey = {
keyUrl = "string"
sourceVault = {
id = "string"
}
}
}
}
}
Property Values
Microsoft.Compute/diskEncryptionSets
| Name |
Description |
Value |
| identity |
The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. |
EncryptionSetIdentity |
| ___location |
Resource ___location |
string (required) |
| name |
The resource name |
string (required) |
| parent_id |
The ID of the resource to apply this extension resource to. |
string (required) |
| properties |
|
EncryptionSetProperties |
| tags |
Resource tags |
Dictionary of tag names and values. |
| type |
The resource type |
"Microsoft.Compute/diskEncryptionSets@2019-11-01" |
EncryptionSetIdentity
| Name |
Description |
Value |
| type |
The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. |
'SystemAssigned' |
EncryptionSetProperties
| Name |
Description |
Value |
| activeKey |
The key vault key which is currently used by this disk encryption set. |
KeyVaultAndKeyReference |
KeyVaultAndKeyReference
| Name |
Description |
Value |
| keyUrl |
Url pointing to a key or secret in KeyVault |
string (required) |
| sourceVault |
Resource id of the KeyVault containing the key or secret |
SourceVault (required) |
SourceVault
| Name |
Description |
Value |
| id |
Resource Id |
string |
Usage Examples
A basic example of deploying Disk Encryption Set.
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
azurerm = {
source = "hashicorp/azurerm"
}
}
}
provider "azurerm" {
features {
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "___location" {
type = string
default = "westeurope"
}
data "azurerm_client_config" "current" {
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
___location = var.___location
}
resource "azapi_resource" "vault" {
type = "Microsoft.KeyVault/vaults@2023-02-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
___location = var.___location
body = {
properties = {
sku = {
family = "A"
name = "standard"
}
accessPolicies = []
enableSoftDelete = true
tenantId = data.azurerm_client_config.current.tenant_id
}
}
schema_validation_enabled = false
response_export_values = ["*"]
lifecycle {
ignore_changes = [body.properties.accessPolicies]
}
}
data "azapi_resource_id" "key" {
type = "Microsoft.KeyVault/vaults/keys@2023-02-01"
parent_id = azapi_resource.vault.id
name = var.resource_name
}
resource "azapi_resource_action" "key" {
type = "Microsoft.KeyVault/vaults/keys@2023-02-01"
resource_id = data.azapi_resource_id.key.id
method = "PUT"
body = {
properties = {
keySize = 2048
kty = "RSA"
keyOps = ["encrypt", "decrypt", "sign", "verify", "wrapKey", "unwrapKey"]
}
}
response_export_values = ["*"]
}
resource "azapi_resource" "diskEncryptionSet" {
type = "Microsoft.Compute/diskEncryptionSets@2022-03-02"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
___location = var.___location
identity {
type = "SystemAssigned"
identity_ids = []
}
body = {
properties = {
activeKey = {
keyUrl = azapi_resource_action.key.output.properties.keyUriWithVersion
sourceVault = {
id = azapi_resource.vault.id
}
}
encryptionType = "EncryptionAtRestWithCustomerKey"
rotationToLatestKeyVersionEnabled = false
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
Azure Verified Modules
The following Azure Verified Modules can be used to deploy this resource type.