File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
Common/Commands.Common.Strategies/Compute
Compute/Commands.Compute/VirtualMachine/Operation Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -35,9 +35,11 @@ public static ResourceConfig<VirtualMachine> CreateVirtualMachineConfig(
35
35
this ResourceConfig < ResourceGroup > resourceGroup ,
36
36
string name ,
37
37
ResourceConfig < NetworkInterface > networkInterface ,
38
+ bool isWindows ,
38
39
string adminUsername ,
39
40
string adminPassword ,
40
- Image image )
41
+ Image image ,
42
+ string size )
41
43
=> Strategy . CreateConfig (
42
44
resourceGroup ,
43
45
name ,
@@ -46,9 +48,8 @@ public static ResourceConfig<VirtualMachine> CreateVirtualMachineConfig(
46
48
OsProfile = new OSProfile
47
49
{
48
50
ComputerName = name ,
49
- WindowsConfiguration = new WindowsConfiguration
50
- {
51
- } ,
51
+ WindowsConfiguration = isWindows ? new WindowsConfiguration { } : null ,
52
+ LinuxConfiguration = isWindows ? null : new LinuxConfiguration ( ) ,
52
53
AdminUsername = adminUsername ,
53
54
AdminPassword = adminPassword ,
54
55
} ,
@@ -64,7 +65,7 @@ public static ResourceConfig<VirtualMachine> CreateVirtualMachineConfig(
64
65
} ,
65
66
HardwareProfile = new HardwareProfile
66
67
{
67
- VmSize = "Standard_DS1_v2"
68
+ VmSize = size
68
69
} ,
69
70
StorageProfile = new StorageProfile
70
71
{
Original file line number Diff line number Diff line change @@ -156,6 +156,9 @@ public class NewAzureVMCommand : VirtualMachineBaseCmdlet
156
156
[ Parameter ( ParameterSetName = StrategyParameterSet , Mandatory = false ) ]
157
157
public string ImageName { get ; set ; } = "Win2016Datacenter" ;
158
158
159
+ [ Parameter ( ParameterSetName = StrategyParameterSet , Mandatory = false ) ]
160
+ public string Size { get ; set ; } = "Standard_DS1_v2" ;
161
+
159
162
public override void ExecuteCmdlet ( )
160
163
{
161
164
switch ( ParameterSetName )
@@ -206,9 +209,11 @@ async Task StrategyExecuteCmdletAsync(IAsyncCmdlet asyncCmdlet)
206
209
var virtualMachine = resourceGroup . CreateVirtualMachineConfig (
207
210
name : Name ,
208
211
networkInterface : networkInterface ,
212
+ isWindows : isWindows ,
209
213
adminUsername : Credential . UserName ,
210
214
adminPassword : new NetworkCredential ( string . Empty , Credential . Password ) . Password ,
211
- image : image . Image ) ;
215
+ image : image . Image ,
216
+ size : Size ) ;
212
217
213
218
var client = new Client ( DefaultProfile . DefaultContext ) ;
214
219
You can’t perform that action at this time.
0 commit comments