Skip to content

Commit 4052d32

Browse files
authored
Merge pull request Azure#9331 from Azure/sergey/ppg-id
PPG with Id for VM/VMSS
2 parents 567b700 + f1db24a commit 4052d32

File tree

18 files changed

+11965
-31
lines changed

18 files changed

+11965
-31
lines changed

src/Compute/Compute.Test/ScenarioTests/StrategiesVirtualMachineTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,19 @@ public void TestSimpleNewVmImageNameMicrosoftSqlUbuntu()
155155
{
156156
TestRunner.RunTestScript("Test-SimpleNewVmImageNameMicrosoftSqlUbuntu");
157157
}
158+
159+
[Fact]
160+
[Trait(Category.AcceptanceType, Category.CheckIn)]
161+
public void TestSimpleNewVmPpg()
162+
{
163+
TestRunner.RunTestScript("Test-SimpleNewVmPpg");
164+
}
165+
166+
[Fact]
167+
[Trait(Category.AcceptanceType, Category.CheckIn)]
168+
public void TestSimpleNewVmPpgId()
169+
{
170+
TestRunner.RunTestScript("Test-SimpleNewVmPpgId");
171+
}
158172
}
159173
}

src/Compute/Compute.Test/ScenarioTests/StrategiesVirtualMachineTests.ps1

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,4 +500,75 @@ function Test-SimpleNewVmImageNameMicrosoftSqlUbuntu
500500
# Cleanup
501501
Clean-ResourceGroup $vmname
502502
}
503+
}
504+
505+
<#
506+
.SYNOPSIS
507+
Test Simple Parameter Set for New Vm with PPG
508+
#>
509+
function Test-SimpleNewVmPpg
510+
{
511+
# Setup
512+
$rgname = Get-ResourceName
513+
514+
try
515+
{
516+
$username = "admin01"
517+
$password = Get-PasswordForVM | ConvertTo-SecureString -AsPlainText -Force
518+
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
519+
$ppgname = "MyPpg"
520+
$vmname = "MyVm"
521+
[string]$domainNameLabel = "$vmname-$vmname".tolower();
522+
523+
# Common
524+
$rg = New-AzResourceGroup -Name $rgname -Location "eastus"
525+
$ppg = New-AzProximityPlacementGroup `
526+
-ResourceGroupName $rgname `
527+
-Name $ppgname `
528+
-Location "eastus"
529+
$vm = New-AzVM -Name $vmname -ResourceGroup $rgname -Credential $cred -DomainNameLabel $domainNameLabel -ProximityPlacementGroup $ppgname
530+
531+
Assert-AreEqual $vm.ProximityPlacementGroup.Id $ppg.Id
532+
}
533+
finally
534+
{
535+
# Cleanup
536+
Clean-ResourceGroup $rgname
537+
}
538+
}
539+
540+
<#
541+
.SYNOPSIS
542+
Test Simple Parameter Set for New Vm with PPG Id
543+
#>
544+
function Test-SimpleNewVmPpgId
545+
{
546+
# Setup
547+
$rgname = Get-ResourceName
548+
$vmname = Get-ResourceName
549+
550+
try
551+
{
552+
$username = "admin01"
553+
$password = Get-PasswordForVM | ConvertTo-SecureString -AsPlainText -Force
554+
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
555+
$ppgname = "MyPpg"
556+
[string]$domainNameLabel = "$vmname-$vmname".tolower();
557+
558+
# Common
559+
$rg = New-AzResourceGroup -Name $rgname -Location "eastus"
560+
$ppg = New-AzProximityPlacementGroup `
561+
-ResourceGroupName $rgname `
562+
-Name $ppgname `
563+
-Location "eastus"
564+
$vm = New-AzVM -Name $vmname -Credential $cred -DomainNameLabel $domainNameLabel -ProximityPlacementGroup $ppg.Id
565+
566+
Assert-AreEqual $vm.ProximityPlacementGroup.Id $ppg.Id
567+
}
568+
finally
569+
{
570+
# Cleanup
571+
Clean-ResourceGroup $rgname
572+
Clean-ResourceGroup $vmname
573+
}
503574
}

src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,12 @@ public void TestSimpleNewVmssWithoutDomainName()
102102
TestRunner.RunTestScript("Test-SimpleNewVmssWithoutDomainName");
103103
create.SetValue(null, oldCreate);
104104
}
105+
106+
[Fact]
107+
[Trait(Category.AcceptanceType, Category.CheckIn)]
108+
public void TestSimpleNewVmssPpg()
109+
{
110+
TestRunner.RunTestScript("Test-SimpleNewVmssPpg");
111+
}
105112
}
106113
}

src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.ps1

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,3 +368,39 @@ function Test-SimpleNewVmssWithoutDomainName
368368
Clean-ResourceGroup $vmssname
369369
}
370370
}
371+
372+
<#
373+
.SYNOPSIS
374+
Test Simple Paremeter Set for New Vm
375+
#>
376+
function Test-SimpleNewVmssPpg
377+
{
378+
# Setup
379+
$rgname = Get-ResourceName
380+
381+
try
382+
{
383+
$vmssname = "MyVmss"
384+
$ppgname = "MyPpg"
385+
$lbName = $vmssname + "LoadBalancer"
386+
$username = "admin01"
387+
$password = Get-PasswordForVM | ConvertTo-SecureString -AsPlainText -Force
388+
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
389+
[string]$domainNameLabel = "$vmssname$vmssname".tolower();
390+
391+
# Common
392+
$rg = New-AzResourceGroup -Name $rgname -Location "eastus"
393+
$ppg = New-AzProximityPlacementGroup `
394+
-ResourceGroupName $rgname `
395+
-Name $ppgname `
396+
-Location "eastus"
397+
$vmss = New-AzVmss -Name $vmssname -ResourceGroup $rgname -Credential $cred -DomainNameLabel $domainNameLabel -LoadBalancerName $lbName -ProximityPlacementGroup $ppgname
398+
399+
Assert-AreEqual $vmss.ProximityPlacementGroup.Id $ppg.Id
400+
}
401+
finally
402+
{
403+
# Cleanup
404+
Clean-ResourceGroup $rgname
405+
}
406+
}

0 commit comments

Comments
 (0)