Skip to content

Commit 9e4205d

Browse files
Merge pull request #115042 from msmbaldwin/ade-githubissues
Fixes for assort. Github Issues
2 parents 5bdf9ea + e27f07a commit 9e4205d

File tree

3 files changed

+52
-28
lines changed

3 files changed

+52
-28
lines changed

articles/virtual-machines/linux/disk-encryption-linux.md

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ The **EncryptFormatAll** parameter reduces the time for Linux data disks to be e
219219
>If you're setting this parameter while updating encryption settings, it might lead to a reboot before the actual encryption. In this case, you will also want to remove the disk you don't want formatted from the fstab file. Similarly, you should add the partition you want encrypt-formatted to the fstab file before initiating the encryption operation.
220220
221221
### EncryptFormatAll criteria
222-
The parameter goes though all partitions and encrypts them as long as they meet **all** of the criteria below:
222+
The parameter goes though all partitions and encrypts them as long as they meet **all** of the criteria below:
223223
- Is not a root/OS/boot partition
224224
- Is not already encrypted
225225
- Is not a BEK volume
@@ -259,36 +259,50 @@ Set-AzVMDiskEncryptionExtension -ResourceGroupName $VMRGName -VMName $vmName -Di
259259
### Use the EncryptFormatAll parameter with Logical Volume Manager (LVM)
260260
We recommend an LVM-on-crypt setup. For all the following examples, replace the device-path and mountpoints with whatever suits your use-case. This setup can be done as follows:
261261

262-
- Add the data disks that will compose the VM.
263-
- Format, mount, and add these disks to the fstab file.
262+
1. Add the data disks that will compose the VM.
264263

265-
1. Choose a partition standard, create a partition that spans the entire drive, and then format the partition. We use symlinks generated by Azure here. Using symlinks avoids problems related to device names changing. For more information, see the [Troubleshoot Device Names problems](troubleshoot-device-names-problems.md) article.
264+
1. Format, mount, and add these disks to the fstab file.
265+
266+
1. Choose a partition standard, create a partition that spans the entire drive, and then format the partition. We use symlinks generated by Azure here. Using symlinks avoids problems related to device names changing. For more information, see the [Troubleshoot Device Names problems](troubleshoot-device-names-problems.md) article.
266267

267-
```azurepowershell-interactive
268-
parted /dev/disk/azure/scsi1/lun0 mklabel gpt
269-
parted -a opt /dev/disk/azure/scsi1/lun0 mkpart primary ext4 0% 100%
270-
271-
mkfs -t ext4 /dev/disk/azure/scsi1/lun0-part1
272-
```
268+
```bash
269+
parted /dev/disk/azure/scsi1/lun0 mklabel gpt
270+
parted -a opt /dev/disk/azure/scsi1/lun0 mkpart primary ext4 0% 100%
273271

274-
1. Mount the disks.
275-
276-
`mount /dev/disk/azure/scsi1/lun0-part1 /mnt/mountpoint`
272+
mkfs -t ext4 /dev/disk/azure/scsi1/lun0-part1
273+
```
274+
275+
1. Mount the disks:
276+
277+
```bash
278+
mount /dev/disk/azure/scsi1/lun0-part1 /mnt/mountpoint
279+
````
277280
278-
1. Add to fstab.
279-
280-
`echo "/dev/disk/azure/scsi1/lun0-part1 /mnt/mountpoint ext4 defaults,nofail 0 2" >> /etc/fstab`
281+
Add to fstab file:
282+
283+
```bash
284+
echo "/dev/disk/azure/scsi1/lun0-part1 /mnt/mountpoint ext4 defaults,nofail 0 2" >> /etc/fstab
285+
```
281286

282-
1. Run the Set-AzVMDiskEncryptionExtension PowerShell cmdlet with -EncryptFormatAll to encrypt these disks.
287+
1. Run the Azure PowerShell [Set-AzVMDiskEncryptionExtension](/powershell/module/az.compute/set-azvmdiskencryptionextension?view=azps-3.8.0) cmdlet with -EncryptFormatAll to encrypt these disks.
283288

284-
```azurepowershell-interactive
285-
$KeyVault = Get-AzKeyVault -VaultName "MySecureVault" -ResourceGroupName "MySecureGroup"
286-
287-
Set-AzVMDiskEncryptionExtension -ResourceGroupName "MySecureGroup" -VMName "MySecureVM" -DiskEncryptionKeyVaultUrl $KeyVault.VaultUri -DiskEncryptionKeyVaultId $KeyVault.ResourceId -EncryptFormatAll -SkipVmBackup -VolumeType Data
288-
```
289+
```azurepowershell-interactive
290+
$KeyVault = Get-AzKeyVault -VaultName "MySecureVault" -ResourceGroupName "MySecureGroup"
291+
292+
Set-AzVMDiskEncryptionExtension -ResourceGroupName "MySecureGroup" -VMName "MySecureVM" -DiskEncryptionKeyVaultUrl $KeyVault.VaultUri -DiskEncryptionKeyVaultId $KeyVault.ResourceId -EncryptFormatAll -SkipVmBackup -VolumeType Data
293+
```
294+
295+
If you wish to use a key encryption key (KEK), pass the URI of your KEK and the ResourceID of your key vault to the -KeyEncryptionKeyUrl and -KeyEncryptionKeyVaultId parameters, respectively:
289296

290-
1. Set up LVM on top of these new disks. Note the encrypted drives are unlocked after the VM has finished booting. So, the LVM mounting will also have to be subsequently delayed.
297+
```azurepowershell-interactive
298+
$KeyVault = Get-AzKeyVault -VaultName "MySecureVault" -ResourceGroupName "MySecureGroup"
299+
$KEKKeyVault = Get-AzKeyVault -VaultName "MyKEKVault" -ResourceGroupName "MySecureGroup"
300+
$KEK = Get-AzKeyVaultKey -VaultName "myKEKVault" -KeyName "myKEKName"
301+
302+
Set-AzVMDiskEncryptionExtension -ResourceGroupName "MySecureGroup" -VMName "MySecureVM" -DiskEncryptionKeyVaultUrl $KeyVault.VaultUri -DiskEncryptionKeyVaultId $KeyVault.ResourceId -EncryptFormatAll -SkipVmBackup -VolumeType Data -KeyEncryptionKeyUrl $$KEK.id -KeyEncryptionKeyVaultId $KEKKeyVault.ResourceId
303+
```
291304

305+
1. Set up LVM on top of these new disks. Note the encrypted drives are unlocked after the VM has finished booting. So, the LVM mounting will also have to be subsequently delayed.
292306

293307
## New VMs created from customer-encrypted VHD and encryption keys
294308
In this scenario, you can enable encrypting by using PowerShell cmdlets or CLI commands.

articles/virtual-machines/linux/disk-encryption-overview.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,26 @@ Linux server distributions that are not endorsed by Azure do not support Azure D
9292

9393
Azure Disk Encryption requires the dm-crypt and vfat modules to be present on the system. Removing or disabling vfat from the default image will prevent the system from reading the key volume and obtaining the key needed to unlock the disks on subsequent reboots. System hardening steps that remove the vfat module from the system are not compatible with Azure Disk Encryption.
9494

95-
Before enabling encryption, the data disks to be encrypted must be properly listed in /etc/fstab. Use a persistent block device name for this entry, as device names in the "/dev/sdX" format can't be relied upon to be associated with the same disk across reboots, particularly after encryption is applied. For more detail on this behavior, see: [Troubleshoot Linux VM device name changes](troubleshoot-device-names-problems.md)
95+
Before enabling encryption, the data disks to be encrypted must be properly listed in /etc/fstab. Use the "nofail" option when creating entries, and choose a persistent block device name (as device names in the "/dev/sdX" format may not be associated with the same disk across reboots, particularly after encryption; for more detail on this behavior, see: [Troubleshoot Linux VM device name changes](troubleshoot-device-names-problems.md)).
9696

9797
Make sure the /etc/fstab settings are configured properly for mounting. To configure these settings, run the mount -a command or reboot the VM and trigger the remount that way. Once that is complete, check the output of the lsblk command to verify that the drive is still mounted.
98+
9899
- If the /etc/fstab file doesn't mount the drive properly before enabling encryption, Azure Disk Encryption won't be able to mount it properly.
99100
- The Azure Disk Encryption process will move the mount information out of /etc/fstab and into its own configuration file as part of the encryption process. Don't be alarmed to see the entry missing from /etc/fstab after data drive encryption completes.
100101
- Before starting encryption, be sure to stop all services and processes that could be writing to mounted data disks and disable them, so that they do not restart automatically after a reboot. These could keep files open on these partitions, preventing the encryption procedure to remount them, causing failure of the encryption.
101102
- After reboot, it will take time for the Azure Disk Encryption process to mount the newly encrypted disks. They won't be immediately available after a reboot. The process needs time to start, unlock, and then mount the encrypted drives before being available for other processes to access. This process may take more than a minute after reboot depending on the system characteristics.
102103

103-
An example of commands that can be used to mount the data disks and create the necessary /etc/fstab entries can be found in the [Azure Disk Encryption prerequisites CLI script](https://github.com/ejarvi/ade-cli-getting-started) (lines 244-248) and the [Azure Disk Encryption prerequisites PowerShell script](https://github.com/Azure/azure-powershell/tree/master/src/Compute/Compute/Extension/AzureDiskEncryption/Scripts).
104-
104+
Here is an example of the commands used to mount the data disks and create the necessary /etc/fstab entries:
105+
106+
```bash
107+
UUID0="$(blkid -s UUID -o value /dev/disk/azure/scsi1/lun0)"
108+
UUID1="$(blkid -s UUID -o value /dev/disk/azure/scsi1/lun1)"
109+
mkdir /data0
110+
mkdir /data1
111+
echo "UUID=$UUID0 /data0 ext4 defaults,nofail 0 0" >>/etc/fstab
112+
echo "UUID=$UUID1 /data1 ext4 defaults,nofail 0 0" >>/etc/fstab
113+
mount -a
114+
```
105115
## Networking requirements
106116

107117
To enable the Azure Disk Encryption feature, the Linux VMs must meet the following network endpoint configuration requirements:

articles/virtual-machines/linux/disk-encryption-powershell-quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ New-AzResourceGroup -Name "myResourceGroup" -Location "EastUS"
2828
Create an Azure virtual machine with [New-AzVM](/powershell/module/az.compute/new-azvm), passing to it the VM configuration object you created above.
2929

3030
```powershell-interactive
31-
$cred = = Get-Credential
31+
$cred = Get-Credential
3232
33-
New-AzVM -Name MyVm -Credential $cred -ResourceGroupName MyResourceGroup -Image Canonical:UbuntuServer:16.04-LTS:latest -Size Standard_D2S_V3
33+
New-AzVM -Name MyVm -Credential $cred -ResourceGroupName MyResourceGroup -Image Canonical:UbuntuServer:18.04-LTS:latest -Size Standard_D2S_V3
3434
```
3535

3636
It will take a few minutes for your VM to be deployed.

0 commit comments

Comments
 (0)