Skip to content

Commit 6abd354

Browse files
committed
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
Conflicts: setup/azurecmdfiles.wxi
2 parents 6087702 + 4485b9b commit 6abd354

File tree

13 files changed

+4938
-490
lines changed

13 files changed

+4938
-490
lines changed

setup/azurecmdfiles.wxi

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -784,9 +784,6 @@
784784
<Component Id="cmp9AA4CD4105408D3F4F12949A1C0940D1" Guid="*">
785785
<File Id="filCC59772EC4CF0F1A839EEE7F778FC1DD" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeAnalytics\AzureRM.DataLakeAnalytics.psd1" />
786786
</Component>
787-
<Component Id="cmpF0BC5F85072B314776B406E9678635AE" Guid="*">
788-
<File Id="filD45A7E77990BF502212EF8291FDEF9DD" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeAnalytics\AzureRM.Tags.psd1" />
789-
</Component>
790787
<Component Id="cmp70A49156E2EDA72CDD86623D5D7012CA" Guid="*">
791788
<File Id="filCD028A52562D61578EF8722308CEF55B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeAnalytics\Hyak.Common.dll" />
792789
</Component>
@@ -805,12 +802,6 @@
805802
<Component Id="cmpCD37CD8F92CDF2D1325CCF4EDCB62243" Guid="*">
806803
<File Id="filD4DA4D8E757F8C680D2F6FF42AB03467" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeAnalytics\Microsoft.Azure.Commands.Tags.dll" />
807804
</Component>
808-
<Component Id="cmpC54661B0DB6347B3045245C9C81EC5DB" Guid="*">
809-
<File Id="fil2431687058B301EFA39192A9F2FB7E51" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeAnalytics\Microsoft.Azure.Commands.Tags.dll-help.xml" />
810-
</Component>
811-
<Component Id="cmp055804D6FD408CD8337F097FEA5E9534" Guid="*">
812-
<File Id="fil793F7B47F24818DD34B1B6152F8A5863" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeAnalytics\Microsoft.Azure.Commands.Tags.format.ps1xml" />
813-
</Component>
814805
<Component Id="cmp88675FAFCC394892AE7CA0D31046C931" Guid="*">
815806
<File Id="fil01D0A4B8CAE4F47AEBAC371F9D4F3CC6" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeAnalytics\Microsoft.Azure.Common.Authentication.dll" />
816807
</Component>
@@ -873,9 +864,6 @@
873864
<Component Id="cmp1626D75E4A091FD36D772FB1DEAEF2E9" Guid="*">
874865
<File Id="fil6DCF5300A481ECBF92B70405D1D3E4F1" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\AzureRM.DataLakeStore.psd1" />
875866
</Component>
876-
<Component Id="cmpAC94BCE1073000D74BA0CD1F747E009F" Guid="*">
877-
<File Id="filB1264EBFFCCDE645A678EC5ABCF1FE80" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\AzureRM.Tags.psd1" />
878-
</Component>
879867
<Component Id="cmpDB37FD2F23B17651F12F7CBA5E841363" Guid="*">
880868
<File Id="fil3207D6A2378983202DB5EB72D67F6A7B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Hyak.Common.dll" />
881869
</Component>
@@ -894,12 +882,6 @@
894882
<Component Id="cmpA9CADA5F5DC40E8AD15DF60107CC92D1" Guid="*">
895883
<File Id="fil6F014B6352009ABA00697624C40BED36" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Commands.Tags.dll" />
896884
</Component>
897-
<Component Id="cmp86CBF8AB770B4397D9B946D051598C04" Guid="*">
898-
<File Id="filFC216260DFE166BBD27562FED80A9048" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Commands.Tags.dll-help.xml" />
899-
</Component>
900-
<Component Id="cmpF408019420E197948E0310D0BF421560" Guid="*">
901-
<File Id="fil0F8C456B047196BACAE6404C2F170AC7" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Commands.Tags.format.ps1xml" />
902-
</Component>
903885
<Component Id="cmp2FE5183EB7E0125AD6C4A8101AB4B55E" Guid="*">
904886
<File Id="fil73D92F1878FF0973F6F1359DAA67D3E9" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Common.Authentication.dll" />
905887
</Component>
@@ -4876,15 +4858,12 @@
48764858
<ComponentRef Id="cmp9E138A369DBE819C972D9BBF4BEC7A7D" />
48774859
<ComponentRef Id="cmpFFD632DFF203CC929CB0CACD3AAE8AE3" />
48784860
<ComponentRef Id="cmp9AA4CD4105408D3F4F12949A1C0940D1" />
4879-
<ComponentRef Id="cmpF0BC5F85072B314776B406E9678635AE" />
48804861
<ComponentRef Id="cmp70A49156E2EDA72CDD86623D5D7012CA" />
48814862
<ComponentRef Id="cmp2FEEAA23FF0F261C6E47AB598DBBF8A6" />
48824863
<ComponentRef Id="cmp5835D87A5A94F44EAAAE61BCA33C1D80" />
48834864
<ComponentRef Id="cmpBFBF6E4B62912618B79304EFC6838BAB" />
48844865
<ComponentRef Id="cmpF9A737C5D10D7520DABFD5A7B1CA19AF" />
48854866
<ComponentRef Id="cmpCD37CD8F92CDF2D1325CCF4EDCB62243" />
4886-
<ComponentRef Id="cmpC54661B0DB6347B3045245C9C81EC5DB" />
4887-
<ComponentRef Id="cmp055804D6FD408CD8337F097FEA5E9534" />
48884867
<ComponentRef Id="cmp88675FAFCC394892AE7CA0D31046C931" />
48894868
<ComponentRef Id="cmpD3A3362A8365705FDC0C19B312EB61FC" />
48904869
<ComponentRef Id="cmp096EEC3ACF260985958CED2DC04BD9A9" />
@@ -4905,15 +4884,12 @@
49054884
<ComponentRef Id="cmp00A233D640AFCDAFCFD4BB5B674360E4" />
49064885
<ComponentRef Id="cmp3D012023B86D27262DE3502AE149FFA6" />
49074886
<ComponentRef Id="cmp1626D75E4A091FD36D772FB1DEAEF2E9" />
4908-
<ComponentRef Id="cmpAC94BCE1073000D74BA0CD1F747E009F" />
49094887
<ComponentRef Id="cmpDB37FD2F23B17651F12F7CBA5E841363" />
49104888
<ComponentRef Id="cmpFA06C9BD3FF76E0DAA7ACE5C9435F394" />
49114889
<ComponentRef Id="cmp5014A98086549EE22F2F2DF9C7C1B1F2" />
49124890
<ComponentRef Id="cmp001FEDC74DD7D918EFE88F2EB8E4285C" />
49134891
<ComponentRef Id="cmpBE1007C3B5920359FED93D232612FA3D" />
49144892
<ComponentRef Id="cmpA9CADA5F5DC40E8AD15DF60107CC92D1" />
4915-
<ComponentRef Id="cmp86CBF8AB770B4397D9B946D051598C04" />
4916-
<ComponentRef Id="cmpF408019420E197948E0310D0BF421560" />
49174893
<ComponentRef Id="cmp2FE5183EB7E0125AD6C4A8101AB4B55E" />
49184894
<ComponentRef Id="cmp87FB43928F7A2ECF62C0141446D21A9F" />
49194895
<ComponentRef Id="cmpD2292657EF3D9CEAC5D4FA7DEB3E7E8E" />

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,9 @@
352352
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachineTags.json">
353353
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
354354
</None>
355+
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachineWithDifferentStorageResource.json">
356+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
357+
</None>
355358
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachineWithVMAgentAutoUpdate.json">
356359
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
357360
</None>

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

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -398,27 +398,28 @@ function Get-SasUri
398398
# Get a Location according to resource provider.
399399
function Get-ResourceProviderLocation
400400
{
401+
param ([string] $provider)
402+
401403
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
402404
{
403-
$namespace = $provider.Split("/")[0]
404-
if($provider.Contains("/"))
405-
{
406-
$type = $provider.Substring($namespace.Length + 1)
407-
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type}
405+
$namespace = $provider.Split("/")[0];
406+
if($provider.Contains("/"))
407+
{
408+
$type = $provider.Substring($namespace.Length + 1);
409+
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type};
408410

409-
if ($location -eq $null)
410-
{
411-
return "West US"
412-
} else
413-
{
414-
return $location.Locations[0]
415-
}
416-
}
417-
418-
return "West US"
411+
if ($location -eq $null)
412+
{
413+
return "westus";
414+
}
415+
else
416+
{
417+
return $location.Locations[0];
418+
}
419+
}
420+
return "westus";
419421
}
420-
421-
return "WestUS"
422+
return "westus";
422423
}
423424

424425
function Get-ComputeVMLocation

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,12 @@ public void TestVirtualMachineListWithPaging()
137137
{
138138
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineListWithPaging");
139139
}
140+
141+
[Fact]
142+
[Trait(Category.AcceptanceType, Category.CheckIn)]
143+
public void TestVirtualMachineWithDifferentStorageResource()
144+
{
145+
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineWithDifferentStorageResource");
146+
}
140147
}
141148
}

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

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,3 +1803,134 @@ function Test-VirtualMachineListWithPaging
18031803
}
18041804
}
18051805

1806+
1807+
<#
1808+
.SYNOPSIS
1809+
Test Virtual Machines
1810+
#>
1811+
function Test-VirtualMachineWithDifferentStorageResource
1812+
{
1813+
# Setup
1814+
$rgname = Get-ComputeTestResourceName
1815+
$rgname_storage = Get-ComputeTestResourceName
1816+
1817+
try
1818+
{
1819+
# Common
1820+
$loc = "eastus";
1821+
New-AzureRmResourceGroup -Name $rgname -Location $loc -Force;
1822+
New-AzureRmResourceGroup -Name $rgname_storage -Location $loc -Force;
1823+
1824+
# VM Profile & Hardware
1825+
$vmsize = 'Standard_A4';
1826+
$vmname = 'vm' + $rgname;
1827+
$p = New-AzureRmVMConfig -VMName $vmname -VMSize $vmsize;
1828+
Assert-AreEqual $p.HardwareProfile.VirtualMachineSize $vmsize;
1829+
1830+
# NRP
1831+
$subnet = New-AzureRmVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
1832+
$vnet = New-AzureRmVirtualNetwork -Force -Name ('vnet' + $rgname) -ResourceGroupName $rgname -Location $loc -AddressPrefix "10.0.0.0/16" -DnsServer "10.1.1.1" -Subnet $subnet;
1833+
$vnet = Get-AzureRmVirtualNetwork -Name ('vnet' + $rgname) -ResourceGroupName $rgname;
1834+
$subnetId = $vnet.Subnets[0].Id;
1835+
$pubip = New-AzureRmPublicIpAddress -Force -Name ('pubip' + $rgname) -ResourceGroupName $rgname -Location $loc -AllocationMethod Dynamic -DomainNameLabel ('pubip' + $rgname);
1836+
$pubip = Get-AzureRmPublicIpAddress -Name ('pubip' + $rgname) -ResourceGroupName $rgname;
1837+
$pubipId = $pubip.Id;
1838+
$nic = New-AzureRmNetworkInterface -Force -Name ('nic' + $rgname) -ResourceGroupName $rgname -Location $loc -SubnetId $subnetId -PublicIpAddressId $pubip.Id;
1839+
$nic = Get-AzureRmNetworkInterface -Name ('nic' + $rgname) -ResourceGroupName $rgname;
1840+
$nicId = $nic.Id;
1841+
1842+
$p = Add-AzureRmVMNetworkInterface -VM $p -Id $nicId;
1843+
Assert-AreEqual $p.NetworkProfile.NetworkInterfaces.Count 1;
1844+
Assert-AreEqual $p.NetworkProfile.NetworkInterfaces[0].ReferenceUri $nicId;
1845+
1846+
# Adding the same Nic but not set it Primary
1847+
$p = Add-AzureRmVMNetworkInterface -VM $p -Id $nicId -Primary;
1848+
Assert-AreEqual $p.NetworkProfile.NetworkInterfaces.Count 1;
1849+
Assert-AreEqual $p.NetworkProfile.NetworkInterfaces[0].ReferenceUri $nicId;
1850+
Assert-AreEqual $p.NetworkProfile.NetworkInterfaces[0].Primary $true;
1851+
1852+
# Storage Account (SA)
1853+
$stoname = 'sto' + $rgname;
1854+
$stotype = 'Standard_GRS';
1855+
New-AzureRmStorageAccount -ResourceGroupName $rgname_storage -Name $stoname -Location $loc -Type $stotype;
1856+
$stoaccount = Get-AzureRmStorageAccount -ResourceGroupName $rgname_storage -Name $stoname;
1857+
1858+
$osDiskName = 'osDisk';
1859+
$osDiskCaching = 'ReadWrite';
1860+
$osDiskVhdUri = "https://$stoname.blob.core.windows.net/test/os.vhd";
1861+
$dataDiskVhdUri1 = "https://$stoname.blob.core.windows.net/test/data1.vhd";
1862+
$dataDiskVhdUri2 = "https://$stoname.blob.core.windows.net/test/data2.vhd";
1863+
$dataDiskVhdUri3 = "https://$stoname.blob.core.windows.net/test/data3.vhd";
1864+
1865+
$p = Set-AzureRmVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption FromImage;
1866+
1867+
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 1 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
1868+
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 2 -VhdUri $dataDiskVhdUri2 -CreateOption Empty;
1869+
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB 12 -Lun 3 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;
1870+
$p = Remove-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3';
1871+
1872+
Assert-AreEqual $p.StorageProfile.OSDisk.Caching $osDiskCaching;
1873+
Assert-AreEqual $p.StorageProfile.OSDisk.Name $osDiskName;
1874+
Assert-AreEqual $p.StorageProfile.OSDisk.VirtualHardDisk.Uri $osDiskVhdUri;
1875+
Assert-AreEqual $p.StorageProfile.DataDisks.Count 2;
1876+
Assert-AreEqual $p.StorageProfile.DataDisks[0].Caching 'ReadOnly';
1877+
Assert-AreEqual $p.StorageProfile.DataDisks[0].DiskSizeGB 10;
1878+
Assert-AreEqual $p.StorageProfile.DataDisks[0].Lun 1;
1879+
Assert-AreEqual $p.StorageProfile.DataDisks[0].VirtualHardDisk.Uri $dataDiskVhdUri1;
1880+
Assert-AreEqual $p.StorageProfile.DataDisks[1].Caching 'ReadOnly';
1881+
Assert-AreEqual $p.StorageProfile.DataDisks[1].DiskSizeGB 11;
1882+
Assert-AreEqual $p.StorageProfile.DataDisks[1].Lun 2;
1883+
Assert-AreEqual $p.StorageProfile.DataDisks[1].VirtualHardDisk.Uri $dataDiskVhdUri2;
1884+
1885+
# OS & Image
1886+
$user = "Foo12";
1887+
$password = 'BaR@123' + $rgname;
1888+
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
1889+
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
1890+
$computerName = 'test';
1891+
$vhdContainer = "https://$stoname.blob.core.windows.net/test";
1892+
1893+
# $p.StorageProfile.OSDisk = $null;
1894+
$p = Set-AzureRmVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred;
1895+
1896+
$imgRef = Get-DefaultCRPImage -loc $loc;
1897+
$p = ($imgRef | Set-AzureRmVMSourceImage -VM $p);
1898+
1899+
Assert-AreEqual $p.OSProfile.AdminUsername $user;
1900+
Assert-AreEqual $p.OSProfile.ComputerName $computerName;
1901+
Assert-AreEqual $p.OSProfile.AdminPassword $password;
1902+
1903+
Assert-AreEqual $p.StorageProfile.ImageReference.Offer $imgRef.Offer;
1904+
Assert-AreEqual $p.StorageProfile.ImageReference.Publisher $imgRef.PublisherName;
1905+
Assert-AreEqual $p.StorageProfile.ImageReference.Sku $imgRef.Skus;
1906+
Assert-AreEqual $p.StorageProfile.ImageReference.Version $imgRef.Version;
1907+
1908+
# Virtual Machine
1909+
New-AzureRmVM -ResourceGroupName $rgname -Location $loc -VM $p;
1910+
1911+
# Get VM
1912+
$vm1 = Get-AzureRmVM -Name $vmname -ResourceGroupName $rgname;
1913+
Assert-AreEqual $vm1.Name $vmname;
1914+
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces.Count 1;
1915+
Assert-AreEqual $vm1.NetworkProfile.NetworkInterfaces[0].ReferenceUri $nicId;
1916+
1917+
Assert-AreEqual $vm1.StorageProfile.ImageReference.Offer $imgRef.Offer;
1918+
Assert-AreEqual $vm1.StorageProfile.ImageReference.Publisher $imgRef.PublisherName;
1919+
Assert-AreEqual $vm1.StorageProfile.ImageReference.Sku $imgRef.Skus;
1920+
Assert-AreEqual $vm1.StorageProfile.ImageReference.Version $imgRef.Version;
1921+
1922+
Assert-AreEqual $vm1.OSProfile.AdminUsername $user;
1923+
Assert-AreEqual $vm1.OSProfile.ComputerName $computerName;
1924+
Assert-AreEqual $vm1.HardwareProfile.VirtualMachineSize $vmsize;
1925+
1926+
Assert-AreEqual $true $vm1.DiagnosticsProfile.BootDiagnostics.Enabled;
1927+
Assert-AreNotEqual $stoaccount.PrimaryEndpoints.Blob $vm1.DiagnosticsProfile.BootDiagnostics.StorageUri;
1928+
}
1929+
finally
1930+
{
1931+
# Cleanup
1932+
Clean-ResourceGroup $rgname
1933+
Clean-ResourceGroup $rgname_storage
1934+
}
1935+
}
1936+

0 commit comments

Comments
 (0)