Skip to content

Commit def485a

Browse files
author
Kamran Khan
committed
Add disable encryption volume check for Linux VMs
1 parent 727639c commit def485a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,20 @@ public override void ExecuteCmdlet()
231231

232232
currentOSType = virtualMachineResponse.StorageProfile.OsDisk.OsType;
233233

234+
if (OperatingSystemTypes.Linux.Equals(currentOSType) &&
235+
!AzureDiskEncryptionExtensionContext.VolumeTypeData.Equals(VolumeType, StringComparison.InvariantCultureIgnoreCase))
236+
{
237+
ThrowTerminatingError(
238+
new ErrorRecord(
239+
new ArgumentException(
240+
string.Format(
241+
CultureInfo.CurrentUICulture,
242+
"Disabling encryption is only allowed on Data volumes for Linux VMs.")),
243+
"InvalidType",
244+
ErrorCategory.NotImplemented,
245+
null));
246+
}
247+
234248
if (this.ShouldProcess(VMName, Properties.Resources.DisableDiskEncryptionAction)
235249
&& (this.Force.IsPresent ||
236250
this.ShouldContinue(Properties.Resources.DisableAzureDiskEncryptionConfirmation, Properties.Resources.DisableAzureDiskEncryptionCaption)))

0 commit comments

Comments
 (0)