Skip to content

Commit f8b8501

Browse files
authored
Add preview for windows VHD. (#12880)
Co-authored-by: wyunchi-ms <[email protected]>
1 parent c0535c1 commit f8b8501

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Aks/Aks/Commands/NewAzureRmAksNodePool.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using System;
16+
using System.Collections.Generic;
1617
using System.Management.Automation;
1718
using Microsoft.Azure.Commands.Aks.Models;
1819
using Microsoft.Azure.Commands.Aks.Properties;
@@ -81,6 +82,10 @@ public class NewAzureRmAksNodePool : NewOrUpdateAgentPoolBase
8182
[PSArgumentCompleter("AvailabilitySet", "VirtualMachineScaleSets")]
8283
public string VmSetType { get; set; }
8384

85+
[Parameter(Mandatory = false, HelpMessage = "Represents type of windows os type. Possible values include: 'aks-windows-2004'")]
86+
[PSArgumentCompleter("aks-windows-2004")]
87+
public string WindowsOSType { get; set; }
88+
8489
[Parameter(Mandatory = false, HelpMessage = "Create node pool even if it already exists")]
8590
public SwitchParameter Force { get; set; }
8691

@@ -99,7 +104,15 @@ public override void ExecuteCmdlet()
99104
ClusterName = ClusterObject.Name;
100105
}
101106
var agentPool = GetAgentPool();
102-
var pool = Client.AgentPools.CreateOrUpdate(ResourceGroupName, ClusterName, Name, agentPool);
107+
Dictionary<string, List<string>> customHeaders = null;
108+
if (this.IsParameterBound(c => c.WindowsOSType))
109+
{
110+
customHeaders = new Dictionary<string, List<string>>
111+
{
112+
{ "CustomizedWindows", new List<string> { WindowsOSType } }
113+
};
114+
}
115+
var pool = Client.AgentPools.CreateOrUpdateWithHttpMessagesAsync(ResourceGroupName, ClusterName, Name, agentPool, customHeaders).GetAwaiter().GetResult().Body;
103116
var psPool = PSMapper.Instance.Map<PSNodePool>(pool);
104117
WriteObject(psPool);
105118
};

0 commit comments

Comments
 (0)