Using Console
Using CLI
az login
az vm show -g <resource-group-name> -n <vm-name> --query storageProfile.osDisk.managedDisk.id -o tsv
az disk encryption set --resource-group <resource-group-name> --name <disk-name> --key-url <key-url> --encryption-type <EncryptionType>
Replace the following parameters in the command:
<resource-group-name>
: Name of the resource group where the VM is located.<disk-name>
: Name of the disk that needs to be encrypted.<key-url>
: URL of the customer-managed key that needs to be used for encryption.<EncryptionType>
: Type of encryption to be used. In this case, it would be “EncryptionAtRestWithCustomerKey”.az disk encryption show --resource-group <resource-group-name> --name <disk-name> --query encryptionSettingsCollection -o json
This command will return the encryption settings for the disk in JSON format.
Using Python