Skip to content

Commit aa314db

Browse files
committed
Update Set-AzureRmOSDisk cmdlet
1 parent bc093a1 commit aa314db

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,4 +452,7 @@ The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip)
452452
<value>Since the VM is created using premium storage, existing standard storage account, {0}, is used for boot diagnostics.</value>
453453
<comment>{0} = existing standard storage account name</comment>
454454
</data>
455+
<data name="VMOSDiskDiskEncryptionBothKekVaultIdAndKekUrlRequired" xml:space="preserve">
456+
<value>You have to specify either both of KeyEncryptionKeyVaultId and KeyEncryptionKeyUrl or none of them.</value>
457+
</data>
455458
</root>

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMOSDiskCommand.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public class SetAzureVMOSDiskCommand : Microsoft.Azure.Commands.ResourceManager.
124124
Position = 7,
125125
ValueFromPipelineByPropertyName = true,
126126
HelpMessage = HelpMessages.VMOSDiskLinuxOSType)]
127-
public Uri DiskEncryptionKeyUrl { get; set; }
127+
public string DiskEncryptionKeyUrl { get; set; }
128128

129129
[Parameter(
130130
ParameterSetName = WindowsDiskEncryptionParameterSet,
@@ -152,7 +152,7 @@ public class SetAzureVMOSDiskCommand : Microsoft.Azure.Commands.ResourceManager.
152152
Position = 9,
153153
ValueFromPipelineByPropertyName = true,
154154
HelpMessage = HelpMessages.VMOSDiskLinuxOSType)]
155-
public Uri KeyEncryptionKeyUrl { get; set; }
155+
public string KeyEncryptionKeyUrl { get; set; }
156156

157157
[Parameter(
158158
ParameterSetName = WindowsDiskEncryptionParameterSet,
@@ -175,6 +175,14 @@ protected override void ProcessRecord()
175175
this.VM.StorageProfile = new StorageProfile();
176176
}
177177

178+
if ((this.KeyEncryptionKeyVaultId == null && this.KeyEncryptionKeyUrl != null)
179+
|| (this.KeyEncryptionKeyVaultId != null && this.KeyEncryptionKeyUrl == null))
180+
{
181+
WriteError(new ErrorRecord(
182+
new Exception(Properties.Resources.VMOSDiskDiskEncryptionBothKekVaultIdAndKekUrlRequired),
183+
string.Empty, ErrorCategory.InvalidArgument, null));
184+
}
185+
178186
this.VM.StorageProfile.OSDisk = new OSDisk
179187
{
180188
Caching = this.Caching,

0 commit comments

Comments
 (0)