Skip to content

Commit 2cf5b13

Browse files
committed
Merge pull request #6 from hyonholee/byol
Add LicenseType parameter to New-AzureVMConfig and BYOL test
2 parents 5ab679c + 8d5af39 commit 2cf5b13

File tree

9 files changed

+2161
-41
lines changed

9 files changed

+2161
-41
lines changed

src/ServiceManagement/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@
322322
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\TestMigrationAbortAzureVNet.json">
323323
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
324324
</None>
325+
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\TestNewAzureVMWithBYOL.json">
326+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
327+
</None>
325328
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.TrafficManagerTests\TestAddAzureTrafficManagerEndpoint.json">
326329
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
327330
</None>

src/ServiceManagement/Common/Commands.ScenarioTest/Resources/ServiceManagement/ServiceManagementTests.ps1

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,3 +773,69 @@ function Test-MigrationAbortAzureVNet
773773
# Cleanup
774774
Remove-AzureVNetConfig
775775
}
776+
777+
778+
function Test-NewAzureVMWithBYOL
779+
{
780+
# Virtual Machine cmdlets are now showing a non-terminating error message for ResourceNotFound
781+
# To continue script, $ErrorActionPreference should be set to 'SilentlyContinue'.
782+
$ErrorActionPreference='SilentlyContinue';
783+
784+
# Setup
785+
$location = "Central US";
786+
$storageName = "mybyolosimagerdfe";
787+
788+
$vm1Name = "vm1";
789+
$vm2Name = "vm2";
790+
$svcName = Get-CloudServiceName;
791+
792+
$vmSize = "Small";
793+
$licenseType = "Windows_Server";
794+
$imgName = getAssetName;
795+
$userName = "User" + $svcName;
796+
$pass = "User@" + $svcName;
797+
798+
$media1 = "http://mybyolosimagerdfe.blob.core.windows.net/myvhd/" + $svcName + "0.vhd";
799+
$media2 = "http://mybyolosimagerdfe.blob.core.windows.net/myvhd/" + $svcName + "1.vhd";
800+
801+
Set-CurrentStorageAccountName $storageName;
802+
803+
Add-AzureVMImage -ImageName $imgName `
804+
-MediaLocation "https://mybyolosimagerdfe.blob.core.windows.net/vhdsrc/win2012-tag0.vhd" `
805+
-OS "Windows" `
806+
-Label "BYOL Image" `
807+
-RecommendedVMSize $vmSize `
808+
-IconUri "http://www.bing.com" `
809+
-SmallIconUri "http://www.bing.com" `
810+
-ShowInGui;
811+
812+
# Test
813+
New-AzureService -ServiceName $svcName -Location $location;
814+
815+
$vm1 = New-AzureVMConfig -Name $vm1Name -ImageName $imgName -InstanceSize $vmSize `
816+
-LicenseType $licenseType -HostCaching ReadWrite -MediaLocation $media1;
817+
818+
$vm1 = Add-AzureProvisioningConfig -VM $vm1 -Windows -Password $pass -AdminUsername $userName;
819+
820+
$vm2 = New-AzureVMConfig -Name $vm2Name -ImageName $imgName -InstanceSize $vmSize `
821+
-LicenseType $licenseType -HostCaching ReadWrite -MediaLocation $media2;
822+
823+
$vm2 = Add-AzureProvisioningConfig -VM $vm2 -Windows -Password $pass -AdminUsername $userName;
824+
825+
New-AzureVM -ServiceName $svcName -VMs $vm1,$vm2
826+
827+
$vm1result = Get-AzureVM -ServiceName $svcName -Name $vm1Name;
828+
$vm2result = Get-AzureVM -ServiceName $svcName -Name $vm2Name;
829+
830+
Update-AzureVM -ServiceName $svcName -Name $vm1Name -VM $vm1result.VM;
831+
832+
$vm1result = Get-AzureVM -ServiceName $svcName -Name $vm1Name;
833+
$vm2result = Get-AzureVM -ServiceName $svcName -Name $vm2Name;
834+
835+
Remove-AzureService -ServiceName $svcName;
836+
837+
Remove-AzureVMImage -ImageName $imgName;
838+
839+
# Cleanup
840+
Cleanup-CloudService $svcName
841+
}

src/ServiceManagement/Common/Commands.ScenarioTest/ServiceManagement/ScenarioTests.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,14 @@ public void TestMigrationAbortAzureVNet()
170170
{
171171
this.RunPowerShellTest("Test-MigrationAbortAzureVNet");
172172
}
173+
174+
[Fact]
175+
[Trait(Category.Service, Category.ServiceManagement)]
176+
[Trait(Category.AcceptanceType, Category.CheckIn)]
177+
[Trait(Category.AcceptanceType, Category.BVT)]
178+
public void TestNewAzureVMWithBYOL()
179+
{
180+
this.RunPowerShellTest("Test-NewAzureVMWithBYOL");
181+
}
173182
}
174183
}

0 commit comments

Comments
 (0)