Remediation
From Azure Portalβ
- Navigate to the
Storage account
that you wish to encrypt. - Select
Encryption
. - Select the
Encryption type
that you wish to use.
If you wish to use a Microsoft-managed key (the default), you can save at this point and encryption will be applied to the account.
If you select Customer-managed keys
, it will ask for the location of the key (The default is an Azure Key Vault) and the key name.
Once these are captured, save the configuration and the account will be encrypted using the provided key.
From Azure CLIβ
Create the Key Vault:
az keyvault create --name <name> --resource-group <resourceGroup> --location <location> --enabled-for-disk-encryption
Encrypt the disk and store the key in Key Vault:
az vm encryption enable -g <resourceGroup> --name <name> --disk-encryption-keyvault myKV
From PowerShellβ
This process uses a Key Vault to store the keys.
Create the Key Vault:
New-AzKeyvault -name <name> -ResourceGroupName <resourceGroup> -Location <location> -EnabledForDiskEncryption
Encrypt the disk and store the key in Key Vault:
$KeyVault = Get-AzKeyVault -VaultName <name> -ResourceGroupName <resourceGroup>
Set-AzVMDiskEncryptionExtension -ResourceGroupName <resourceGroup> -VMName <name> -DiskEncryptionKeyVaultUrl $KeyVault.VaultUri -DiskEncryptionKeyVaultId $KeyVault.ResourceId