Skip to content

Commit 33fad98

Browse files
authored
Adding missed TL Standard scenario in New-AzVmssConfig and adding example documentation (#22651)
* missed scenario * re-recorded test * test rework * changelog
1 parent 9d48609 commit 33fad98

File tree

6 files changed

+3311
-1076
lines changed

6 files changed

+3311
-1076
lines changed

src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4666,7 +4666,7 @@ function Test-VirtualMachineScaleSetSecurityTypeStandardWithConfig
46664666
$PublisherName = "MicrosoftWindowsServer";
46674667
$Offer = "WindowsServer";
46684668
$SKU = "2016-datacenter-gensecond";
4669-
$securityType = "Standard";
4669+
$securityTypeStnd = "Standard";
46704670
$enable = $true;
46714671
$disable = $false;
46724672

@@ -4690,8 +4690,7 @@ function Test-VirtualMachineScaleSetSecurityTypeStandardWithConfig
46904690
$imgRef.Offer = $Offer;
46914691
$imgRef.Skus = $SKU;
46924692
$imgRef.Version = "latest";
4693-
4694-
4693+
46954694
$ipCfg = New-AzVmssIPConfig -Name 'test' -SubnetId $subnetId;
46964695

46974696
$vmss = New-AzVmssConfig -Location $loc -SkuCapacity 2 -SkuName $vmssSize -UpgradePolicyMode 'Manual' `
@@ -4702,13 +4701,39 @@ function Test-VirtualMachineScaleSetSecurityTypeStandardWithConfig
47024701
-ImageReferencePublisher $imgRef.PublisherName ;
47034702

47044703
# Create Vmss
4705-
$vmss1 = Set-AzVmssSecurityProfile -VirtualMachineScaleSet $vmss -SecurityType $securityType;
4704+
$vmss1 = Set-AzVmssSecurityProfile -VirtualMachineScaleSet $vmss -SecurityType $securityTypeStnd;
47064705
$result = New-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName1 -VirtualMachineScaleSet $vmss1;
47074706
$vmssGet = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName1;
47084707

47094708
# Verify security value
47104709
Assert-Null $vmssGet.VirtualMachineProfile.SecurityProfile;
47114710

4711+
4712+
# 2nd Scenario, SecurityType passed into only New-AzVmssConfig and not Set-AzVmssSecurityProfile.
4713+
$vmssName2 = 'vmss2' + $rgname;
4714+
$nameprefix = "test2";
4715+
# NRP
4716+
$vnetworkName = 'vnet2' + $rgname;
4717+
$subnetName = 'subnet2' + $rgname;
4718+
$subnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix "10.0.0.0/24";
4719+
$vnet = New-AzVirtualNetwork -Name $vnetworkName -ResourceGroupName $rgname -Location $loc -AddressPrefix "10.0.0.0/16" -Subnet $subnet;
4720+
$vnet = Get-AzVirtualNetwork -Name $vnetworkName -ResourceGroupName $rgname;
4721+
$subnetId = $vnet.Subnets[0].Id;
4722+
$ipCfg = New-AzVmssIPConfig -Name $nameprefix -SubnetId $subnetId;
4723+
4724+
$vmss2 = New-AzVmssConfig -Location $loc -SkuCapacity 2 -SkuName $vmssSize -UpgradePolicyMode 'Manual' -SecurityType $securityTypeStnd `
4725+
| Add-AzVmssNetworkInterfaceConfiguration -Name $nameprefix -Primary $true -IPConfiguration $ipCfg `
4726+
| Set-AzVmssOSProfile -ComputerNamePrefix $nameprefix -AdminUsername $adminUsername -AdminPassword $adminPassword `
4727+
| Set-AzVmssStorageProfile -OsDiskCreateOption 'FromImage' -OsDiskCaching 'ReadOnly' `
4728+
-ImageReferenceOffer $imgRef.Offer -ImageReferenceSku $imgRef.Skus -ImageReferenceVersion $imgRef.Version `
4729+
-ImageReferencePublisher $imgRef.PublisherName ;
4730+
# Create Vmss
4731+
$result2 = New-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName2 -VirtualMachineScaleSet $vmss2;
4732+
$vmssGet2 = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName2;
4733+
4734+
# Verify security value
4735+
Assert-Null $vmssGet2.VirtualMachineProfile.SecurityProfile;
4736+
47124737
}
47134738
finally
47144739
{

src/Compute/Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineScaleSetTests/TestVirtualMachineScaleSetSecurityTypeStandardWithConfig.json

Lines changed: 1737 additions & 455 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)