Skip to content

Commit 5fdfaf2

Browse files
author
Kamran Khan
committed
Use non-null settings for reverting encryption
1 parent 43f1605 commit 5fdfaf2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/SetAzureDiskEncryptionExtension.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,12 @@ private AzureOperationResponse<VirtualMachine> UpdateVmEncryptionSettings()
284284

285285
DiskEncryptionSettings encryptionSettingsBackup = vmParameters.StorageProfile.OsDisk.EncryptionSettings;
286286

287+
if (encryptionSettingsBackup == null)
288+
{
289+
encryptionSettingsBackup = new DiskEncryptionSettings();
290+
encryptionSettingsBackup.Enabled = false;
291+
}
292+
287293
DiskEncryptionSettings encryptionSettings = new DiskEncryptionSettings();
288294
encryptionSettings.Enabled = true;
289295
encryptionSettings.DiskEncryptionKey = new KeyVaultSecretReference();

0 commit comments

Comments
 (0)