Using Console
Using CLI
az disk list --query "[?managedBy==null]"
az disk encryption set --resource-group <resource-group-name> --name <disk-name> --encryption-type EncryptionAtRestWithCustomerKey --disk-encryption-key <key-uri> --key-encryption-key <key-uri>
Here, replace <resource-group-name>
with the name of the resource group containing the unattached disk, <disk-name>
with the name of the unattached disk, <key-uri>
with the URI of the customer-managed key (CMK) that you want to use for encryption.
az disk show --resource-group <resource-group-name> --name <disk-name> --query "encryptionSettings.collection[].diskEncryptionKey"
This command will show the encryption status of the disk and the key used for encryption.
Using Python
<subscription_id>
, <resource_group_name>
, <disk_name>
, <encryption_set_name>
, <client_id>
, <client_secret>
, and <tenant_id>
with the appropriate values.