Skip to content

Commit d02434f

Browse files
committed
Merge pull request #25 from Azure/ignite
Ignite
2 parents 6366e3a + 63613fc commit d02434f

13 files changed

+9020
-4871
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6868
</Reference>
6969
<Reference Include="Microsoft.Azure.Management.Compute, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.5.0.0-preview\lib\net40\Microsoft.Azure.Management.Compute.dll</HintPath>
71-
<Private>True</Private>
70+
<SpecificVersion>False</SpecificVersion>
71+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.5.0.1-preview\lib\net40\Microsoft.Azure.Management.Compute.dll</HintPath>
7272
</Reference>
7373
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7474
<SpecificVersion>False</SpecificVersion>

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineNetworkInterfaceTests.ps1

Lines changed: 57 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function Test-SingleNetworkInterface
2424
try
2525
{
2626
# Common
27-
$loc = 'West US';
27+
$loc = 'eastasia';
2828
New-AzureResourceGroup -Name $rgname -Location $loc;
2929

3030
# VM Profile & Hardware
@@ -54,7 +54,7 @@ function Test-SingleNetworkInterface
5454
$stoname = 'sto' + $rgname;
5555
$stotype = 'Standard_GRS';
5656
New-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype;
57-
Retry-IfException { $global:stoaccount = Get-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname; }
57+
$stoaccount = Get-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname;
5858

5959
$osDiskName = 'osDisk';
6060
$osDiskCaching = 'ReadWrite';
@@ -63,11 +63,11 @@ function Test-SingleNetworkInterface
6363
$dataDiskVhdUri2 = "https://$stoname.blob.core.windows.net/test/data2.vhd";
6464
$dataDiskVhdUri3 = "https://$stoname.blob.core.windows.net/test/data3.vhd";
6565

66-
$p = Set-AzureVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption Empty;
66+
$p = Set-AzureVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption FromImage;
6767

68-
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 0 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
69-
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 1 -VhdUri $dataDiskVhdUri2 -CreateOption Empty;
70-
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB 12 -Lun 2 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;
68+
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 1 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
69+
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 2 -VhdUri $dataDiskVhdUri2 -CreateOption Empty;
70+
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB 12 -Lun 3 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;
7171
$p = Remove-AzureVMDataDisk -VM $p -Name 'testDataDisk3';
7272

7373
Assert-AreEqual $p.StorageProfile.OSDisk.Caching $osDiskCaching;
@@ -76,11 +76,11 @@ function Test-SingleNetworkInterface
7676
Assert-AreEqual $p.StorageProfile.DataDisks.Count 2;
7777
Assert-AreEqual $p.StorageProfile.DataDisks[0].Caching 'ReadOnly';
7878
Assert-AreEqual $p.StorageProfile.DataDisks[0].DiskSizeGB 10;
79-
Assert-AreEqual $p.StorageProfile.DataDisks[0].Lun 0;
79+
Assert-AreEqual $p.StorageProfile.DataDisks[0].Lun 1;
8080
Assert-AreEqual $p.StorageProfile.DataDisks[0].VirtualHardDisk.Uri $dataDiskVhdUri1;
8181
Assert-AreEqual $p.StorageProfile.DataDisks[1].Caching 'ReadOnly';
8282
Assert-AreEqual $p.StorageProfile.DataDisks[1].DiskSizeGB 11;
83-
Assert-AreEqual $p.StorageProfile.DataDisks[1].Lun 1;
83+
Assert-AreEqual $p.StorageProfile.DataDisks[1].Lun 2;
8484
Assert-AreEqual $p.StorageProfile.DataDisks[1].VirtualHardDisk.Uri $dataDiskVhdUri2;
8585

8686
# OS & Image
@@ -92,14 +92,22 @@ function Test-SingleNetworkInterface
9292
$vhdContainer = "https://$stoname.blob.core.windows.net/test";
9393
$img = 'a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-Datacenter-201503.01-en.us-127GB.vhd';
9494

95-
$p.StorageProfile.OSDisk = $null;
95+
# $p.StorageProfile.OSDisk = $null;
9696
$p = Set-AzureVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred;
97-
$p = Set-AzureVMSourceImage -VM $p -Name $img;
9897

9998
Assert-AreEqual $p.OSProfile.AdminUsername $user;
10099
Assert-AreEqual $p.OSProfile.ComputerName $computerName;
101100
Assert-AreEqual $p.OSProfile.AdminPassword $password;
102-
Assert-AreEqual $p.StorageProfile.SourceImage.ReferenceUri ('/' + (Get-AzureSubscription -Current).SubscriptionId + '/services/images/' + $img);
101+
102+
# Image Reference;
103+
$p.StorageProfile.SourceImage = $null;
104+
$imgRef = Get-DefaultCRPImage;
105+
$p = Set-AzureVMSourceImage -VM $p -ImageReference $imgRef;
106+
Assert-NotNull $p.StorageProfile.ImageReference;
107+
Assert-Null $p.StorageProfile.SourceImageId;
108+
109+
# TODO: Remove Data Disks for now
110+
$p.StorageProfile.DataDisks = $null;
103111

104112
# Virtual Machine
105113
# TODO: Still need to do retry for New-AzureVM for SA, even it's returned in Get-.
@@ -110,11 +118,7 @@ function Test-SingleNetworkInterface
110118
Assert-AreEqual $vm1.Name $vmname;
111119
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces.Count 1;
112120
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces[0].ReferenceUri $nicId;
113-
Assert-AreEqual $vm1.StorageProfile.SourceImage.ReferenceUri ('/' + (Get-AzureSubscription -Current).SubscriptionId + '/services/images/' + $img);
114-
Assert-AreEqual $vm1.OSProfile.AdminUsername $user;
115-
Assert-AreEqual $vm1.OSProfile.ComputerName $computerName;
116-
Assert-AreEqual $vm1.HardwareProfile.VirtualMachineSize $vmsize;
117-
121+
118122
# Get NetworkInterface
119123
$getnic = Get-AzureNetworkInterface -Name ('nic' + $rgname) -ResourceGroupName $rgname;
120124
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces[0].ReferenceUri $getnic.Id;
@@ -143,7 +147,7 @@ function Test-SingleNetworkInterfaceDnsSettings
143147
try
144148
{
145149
# Common
146-
$loc = 'West US';
150+
$loc = 'eastasia';
147151
New-AzureResourceGroup -Name $rgname -Location $loc;
148152

149153
# VM Profile & Hardware
@@ -173,7 +177,7 @@ function Test-SingleNetworkInterfaceDnsSettings
173177
$stoname = 'sto' + $rgname;
174178
$stotype = 'Standard_GRS';
175179
New-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype;
176-
Retry-IfException { $global:stoaccount = Get-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname; }
180+
$stoaccount = Get-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname;
177181

178182
$osDiskName = 'osDisk';
179183
$osDiskCaching = 'ReadWrite';
@@ -182,11 +186,11 @@ function Test-SingleNetworkInterfaceDnsSettings
182186
$dataDiskVhdUri2 = "https://$stoname.blob.core.windows.net/test/data2.vhd";
183187
$dataDiskVhdUri3 = "https://$stoname.blob.core.windows.net/test/data3.vhd";
184188

185-
$p = Set-AzureVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption Empty;
189+
$p = Set-AzureVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption FromImage;
186190

187-
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 0 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
188-
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 1 -VhdUri $dataDiskVhdUri2 -CreateOption Empty;
189-
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB 12 -Lun 2 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;
191+
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 1 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
192+
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 2 -VhdUri $dataDiskVhdUri2 -CreateOption Empty;
193+
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB 12 -Lun 3 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;
190194
$p = Remove-AzureVMDataDisk -VM $p -Name 'testDataDisk3';
191195

192196
# OS & Image
@@ -198,16 +202,28 @@ function Test-SingleNetworkInterfaceDnsSettings
198202
$vhdContainer = "https://$stoname.blob.core.windows.net/test";
199203
$img = 'a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-Datacenter-201503.01-en.us-127GB.vhd';
200204

201-
$p.StorageProfile.OSDisk = $null;
205+
# $p.StorageProfile.OSDisk = $null;
202206
$p = Set-AzureVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred;
203-
$p = Set-AzureVMSourceImage -VM $p -Name $img;
207+
208+
# Image Reference;
209+
$p.StorageProfile.SourceImage = $null;
210+
$imgRef = Get-DefaultCRPImage;
211+
$p = Set-AzureVMSourceImage -VM $p -ImageReference $imgRef;
212+
Assert-NotNull $p.StorageProfile.ImageReference;
213+
Assert-Null $p.StorageProfile.SourceImageId;
214+
215+
# TODO: Remove Data Disks for now
216+
$p.StorageProfile.DataDisks = $null;
204217

205218
# Virtual Machine
206219
# TODO: Still need to do retry for New-AzureVM for SA, even it's returned in Get-.
207220
New-AzureVM -ResourceGroupName $rgname -Location $loc -Name $vmname -VM $p;
208221

209222
# Get VM
210223
$vm1 = Get-AzureVM -Name $vmname -ResourceGroupName $rgname;
224+
Assert-AreEqual $vm1.Name $vmname;
225+
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces.Count 1;
226+
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces[0].ReferenceUri $nicId;
211227

212228
# Get NetworkInterface
213229
$getnic = Get-AzureNetworkInterface -Name ('nic' + $rgname) -ResourceGroupName $rgname;
@@ -238,7 +254,7 @@ function Test-MultipleNetworkInterface
238254
try
239255
{
240256
# Common
241-
$loc = 'West US';
257+
$loc = 'eastasia';
242258
New-AzureResourceGroup -Name $rgname -Location $loc;
243259

244260
# VM Profile & Hardware
@@ -267,11 +283,11 @@ function Test-MultipleNetworkInterface
267283
Assert-AreEqual $p.NetworkProfile.NetworkInterfaces[1].Primary true;
268284
Assert-AreNotEqual $p.NetworkProfile.NetworkInterfaces[0].Primary true;
269285

270-
# Storage Account (SA)
286+
# Storage Account (SA)
271287
$stoname = 'sto' + $rgname;
272288
$stotype = 'Standard_GRS';
273289
New-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype;
274-
Retry-IfException { $global:stoaccount = Get-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname; }
290+
$stoaccount = Get-AzureStorageAccount -ResourceGroupName $rgname -Name $stoname;
275291

276292
$osDiskName = 'osDisk';
277293
$osDiskCaching = 'ReadWrite';
@@ -280,26 +296,13 @@ function Test-MultipleNetworkInterface
280296
$dataDiskVhdUri2 = "https://$stoname.blob.core.windows.net/test/data2.vhd";
281297
$dataDiskVhdUri3 = "https://$stoname.blob.core.windows.net/test/data3.vhd";
282298

283-
$p = Set-AzureVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption Empty;
299+
$p = Set-AzureVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption FromImage;
284300

285-
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 0 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
286-
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 1 -VhdUri $dataDiskVhdUri2 -CreateOption Empty;
287-
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB 12 -Lun 2 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;
301+
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 1 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
302+
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 2 -VhdUri $dataDiskVhdUri2 -CreateOption Empty;
303+
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB 12 -Lun 3 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;
288304
$p = Remove-AzureVMDataDisk -VM $p -Name 'testDataDisk3';
289305

290-
Assert-AreEqual $p.StorageProfile.OSDisk.Caching $osDiskCaching;
291-
Assert-AreEqual $p.StorageProfile.OSDisk.Name $osDiskName;
292-
Assert-AreEqual $p.StorageProfile.OSDisk.VirtualHardDisk.Uri $osDiskVhdUri;
293-
Assert-AreEqual $p.StorageProfile.DataDisks.Count 2;
294-
Assert-AreEqual $p.StorageProfile.DataDisks[0].Caching 'ReadOnly';
295-
Assert-AreEqual $p.StorageProfile.DataDisks[0].DiskSizeGB 10;
296-
Assert-AreEqual $p.StorageProfile.DataDisks[0].Lun 0;
297-
Assert-AreEqual $p.StorageProfile.DataDisks[0].VirtualHardDisk.Uri $dataDiskVhdUri1;
298-
Assert-AreEqual $p.StorageProfile.DataDisks[1].Caching 'ReadOnly';
299-
Assert-AreEqual $p.StorageProfile.DataDisks[1].DiskSizeGB 11;
300-
Assert-AreEqual $p.StorageProfile.DataDisks[1].Lun 1;
301-
Assert-AreEqual $p.StorageProfile.DataDisks[1].VirtualHardDisk.Uri $dataDiskVhdUri2;
302-
303306
# OS & Image
304307
$user = "Foo12";
305308
$password = 'BaR@123' + $rgname;
@@ -309,14 +312,18 @@ function Test-MultipleNetworkInterface
309312
$vhdContainer = "https://$stoname.blob.core.windows.net/test";
310313
$img = 'a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-Datacenter-201503.01-en.us-127GB.vhd';
311314

312-
$p.StorageProfile.OSDisk = $null;
315+
# $p.StorageProfile.OSDisk = $null;
313316
$p = Set-AzureVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred;
314-
$p = Set-AzureVMSourceImage -VM $p -Name $img;
315317

316-
Assert-AreEqual $p.OSProfile.AdminUsername $user;
317-
Assert-AreEqual $p.OSProfile.ComputerName $computerName;
318-
Assert-AreEqual $p.OSProfile.AdminPassword $password;
319-
Assert-AreEqual $p.StorageProfile.SourceImage.ReferenceUri ('/' + (Get-AzureSubscription -Current).SubscriptionId + '/services/images/' + $img);
318+
# Image Reference;
319+
$p.StorageProfile.SourceImage = $null;
320+
$imgRef = Get-DefaultCRPImage;
321+
$p = Set-AzureVMSourceImage -VM $p -ImageReference $imgRef;
322+
Assert-NotNull $p.StorageProfile.ImageReference;
323+
Assert-Null $p.StorageProfile.SourceImageId;
324+
325+
# TODO: Remove Data Disks for now
326+
$p.StorageProfile.DataDisks = $null;
320327

321328
# Virtual Machine
322329
# TODO: Still need to do retry for New-AzureVM for SA, even it's returned in Get-.
@@ -328,10 +335,6 @@ function Test-MultipleNetworkInterface
328335
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces.Count 2;
329336
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces[0].ReferenceUri $nic1.Id;
330337
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces[1].ReferenceUri $nic2.Id;
331-
Assert-AreEqual $vm1.StorageProfile.SourceImage.ReferenceUri ('/' + (Get-AzureSubscription -Current).SubscriptionId + '/services/images/' + $img);
332-
Assert-AreEqual $vm1.OSProfile.AdminUsername $user;
333-
Assert-AreEqual $vm1.OSProfile.ComputerName $computerName;
334-
Assert-AreEqual $vm1.HardwareProfile.VirtualMachineSize $vmsize;
335338

336339
# Get NetworkInterface
337340
$getnic1 = Get-AzureNetworkInterface -Name ('nic1' + $rgname) -ResourceGroupName $rgname;

0 commit comments

Comments
 (0)