Skip to content

Commit 9d357bf

Browse files
authored
Merge pull request #535 from microsoft/dev
Dev
2 parents efa26b9 + 6dbaa03 commit 9d357bf

File tree

9 files changed

+557
-164
lines changed

9 files changed

+557
-164
lines changed

Scenarios/AzSHCI Deployment 22H2 Edition/LabConfig.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ $LabConfig=@{AllowedVLANs="1-10,711-719" ; DomainAdminName='LabAdmin'; AdminPass
33
#Azure Stack HCI 21H2
44
1..4 | ForEach-Object {$LABConfig.VMs += @{ VMName = "AzSHCI$_" ; Configuration = 'S2D' ; ParentVHD = 'AzSHCI22H2_G2.vhdx' ; HDDNumber = 4 ; HDDSize= 2TB ; MemoryStartupBytes= 1GB; VMProcessorCount=4 ; vTPM=$true}}
55
#Or with nested virtualization enabled
6-
#1..4 | ForEach-Object {$LABonfig.VMs += @{ VMName = "AzSHCI$_" ; ConfiguratioCn = 'S2D' ; ParentVHD = 'AzSHCI22H2_G2.vhdx' ; HDDNumber = 10 ; HDDSize= 10TB ; MemoryStartupBytes= 4GB; VMProcessorCount="4" ; vTPM=$true ; NestedVirt=$true}}
6+
#1..4 | ForEach-Object {$LABonfig.VMs += @{ VMName = "AzSHCI$_" ; Configuration = 'S2D' ; ParentVHD = 'AzSHCI22H2_G2.vhdx' ; HDDNumber = 4 ; HDDSize= 2TB ; MemoryStartupBytes= 4GB; VMProcessorCount=4 ; vTPM=$true ; NestedVirt=$true}}
77

88
#Optional Windows Admin Center in GW mode
99
$LabConfig.VMs += @{ VMName = 'WACGW' ; ParentVHD = 'Win2022Core_G2.vhdx'; MGMTNICs=1}

Scenarios/AzSHCI Deployment 22H2 Edition/Scenario.ps1

Lines changed: 215 additions & 136 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
## Notes:
22
* Notice AllowedVLANs in labconfig (to simulate VLANs configuration in NetATC)
33
* CreateParentDisk will create VHD with name AzSHCI**21**H2_G2.vhdx even with 22h2 media. Please rename VHDx manually
4-
* Make sure you use latest 21H2 cumulative update (at least version 20348.1070 - september preview CU) as there are new cluster parameters (not yet used in lab), but it might be useful
4+
* Make sure you use latest 22H2 cumulative update (at least version 20348.1070 - september preview CU) as there are new cluster parameters (not yet used in lab), but it might be useful
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
$LabConfig=@{ DomainAdminName='LabAdmin'; AdminPassword='LS1setup!' ; Prefix = 'MSLab-' ; DCEdition='4'; Internet=$true ; TelemetryLevel='Full' ; TelemetryNickname='' ; AdditionalNetworksConfig=@(); VMs=@()}
22

3-
#3 nodes for AzSHCI Cluster
3+
#4 nodes for AzSHCI Cluster
44
1..4 | ForEach-Object {$VMNames="Exp" ; $LABConfig.VMs += @{ VMName = "$VMNames$_" ; Configuration = 'S2D' ; ParentVHD = 'AzSHCI21H2_G2.vhdx' ; HDDNumber = 4 ; HDDSize= 4TB ; MemoryStartupBytes= 4GB; VMProcessorCount=4 ; NestedVirt=$true ; VirtualTPM=$true}}
5+
6+
#3 nodes for AzSHCI Cluster light - without nested virtualization
7+
#1..3 | ForEach-Object {$VMNames="Exp" ; $LABConfig.VMs += @{ VMName = "$VMNames$_" ; Configuration = 'S2D' ; ParentVHD = 'AzSHCI21H2_G2.vhdx' ; HDDNumber = 4 ; HDDSize= 4TB ; VMProcessorCount=4 ; VirtualTPM=$true}}

Scenarios/AzSHCI and Cluster Expansion/Scenario.ps1

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
$ClusterName="Exp-Cluster"
88
$vSwitchName="vSwitch"
99

10-
# Install features for management on server
10+
# Install features for management
1111
Install-WindowsFeature -Name RSAT-DHCP,RSAT-Clustering,RSAT-Clustering-Mgmt,RSAT-Clustering-PowerShell,RSAT-Hyper-V-Tools
1212

1313
# Install features on server
@@ -25,11 +25,11 @@
2525
do{$Test= Test-NetConnection -ComputerName $Server -CommonTCPPort WINRM}while ($test.TcpTestSucceeded -eq $False)
2626
#}
2727
# create vSwitch from first connected NIC
28-
$NetAdapterName=(Get-NetAdapter -Cimsession $Server | Where-Object HardwareInterface -eq $True | Where-Object Status -eq UP | Sort-Object InterfaceAlias | Select-Object -First 1).InterfaceAlias
29-
New-VMSwitch -Cimsession $Server -Name $vSwitchName -EnableEmbeddedTeaming $TRUE -NetAdapterName $NetAdapterName -EnableIov $true
28+
$NetAdapterName=(Get-NetAdapter -CimSession $Server | Where-Object HardwareInterface -eq $True | Where-Object Status -eq UP | Sort-Object InterfaceAlias | Select-Object -First 1).InterfaceAlias
29+
New-VMSwitch -CimSession $Server -Name $vSwitchName -EnableEmbeddedTeaming $TRUE -NetAdapterName $NetAdapterName -EnableIov $true
3030

3131
#rename vNIC
32-
Rename-VMNetworkAdapter -Cimsession $Server -ManagementOS -Name $vSwitchName -NewName Management
32+
Rename-VMNetworkAdapter -CimSession $Server -ManagementOS -Name $vSwitchName -NewName Management
3333

3434
#create cluster with Distributed Network Name (to not consume extra IP, because why not)
3535
New-Cluster -Name $ClusterName -Node $Server -ManagementPointNetworkType "Distributed"
@@ -125,17 +125,16 @@
125125
New-Item -Path "\\$ClusterName\ClusterStorage$\$VolumeFriendlyName\$VMName\Virtual Hard Disks" -ItemType Directory
126126
Copy-Item -Path $VHDPath -Destination "\\$ClusterName\ClusterStorage$\$VolumeFriendlyName\$VMName\Virtual Hard Disks\$VMName.vhdx"
127127
$VM=New-VM -Name $VMName -MemoryStartupBytes 512MB -Generation 2 -Path "c:\ClusterStorage\$VolumeFriendlyName\" -VHDPath "c:\ClusterStorage\$VolumeFriendlyName\$VMName\Virtual Hard Disks\$VMName.vhdx" -CimSession ((Get-ClusterNode -Cluster $ClusterName).Name | Get-Random)
128-
128+
#start VM
129+
$VM | Start-VM
129130
}else{
130131
Invoke-Command -ComputerName ((Get-ClusterNode -Cluster $ClusterName).Name | Get-Random) -ScriptBlock {
131132
#create some fake VMs
132-
$VM=New-VM -Name $using:VMName -NewVHDPath "c:\ClusterStorage\$($using:VolumeFriendlyName)\$($using:VMName)\Virtual Hard Disks\$($using:VMName).vhdx" -NewVHDSizeBytes 32GB -SwitchName $using:vSwitchName -Generation 2 -Path "c:\ClusterStorage\$($using:VolumeFriendlyName)\" -MemoryStartupBytes 32MB
133+
New-VM -Name $using:VMName -NewVHDPath "c:\ClusterStorage\$($using:VolumeFriendlyName)\$($using:VMName)\Virtual Hard Disks\$($using:VMName).vhdx" -NewVHDSizeBytes 32GB -SwitchName $using:vSwitchName -Generation 2 -Path "c:\ClusterStorage\$($using:VolumeFriendlyName)\" -MemoryStartupBytes 32MB
133134
}
134135
}
135136
#make it HA
136137
Add-ClusterVirtualMachineRole -VMName $VMName -Cluster $ClusterName
137-
#start VM
138-
$VM | Start-VM
139138
#endregion
140139
#endregion
141140

@@ -153,10 +152,8 @@
153152
Restart-Computer -ComputerName $SecondNodeName -Protocol WSMan -Wait -For PowerShell
154153
#failsafe - sometimes it evaluates, that servers completed restart after first restart (hyper-v needs 2)
155154
Start-sleep 20
156-
#make sure computers are restarted
157-
#Foreach ($Server in $Servers){
158-
do{$Test= Test-NetConnection -ComputerName $SecondNodeName -CommonTCPPort WINRM}while ($test.TcpTestSucceeded -eq $False)
159-
#}
155+
#make sure computer is restarted
156+
do{$Test= Test-NetConnection -ComputerName $SecondNodeName -CommonTCPPort WINRM}while ($test.TcpTestSucceeded -eq $False)
160157
#endregion
161158

162159
#region configure networking (assuming scalable, converged networking).
@@ -180,9 +177,9 @@
180177
#create vSwitch on second node
181178
#create vSwitch
182179
$NetAdapterNames=(Get-NetAdapter -CimSession $SecondNodeName | Where-Object HardwareInterface -eq $True | Where-Object Status -eq UP | Sort-Object InterfaceAlias).InterfaceAlias
183-
New-VMSwitch -Cimsession $SecondNodeName -Name $vSwitchName -EnableEmbeddedTeaming $TRUE -NetAdapterName $NetAdapterNames -EnableIov $true
180+
New-VMSwitch -CimSession $SecondNodeName -Name $vSwitchName -EnableEmbeddedTeaming $True -NetAdapterName $NetAdapterNames -EnableIov $true
184181
#rename vNIC
185-
Rename-VMNetworkAdapter -Cimsession $SecondNodeName -ManagementOS -Name $vSwitchName -NewName Management
182+
Rename-VMNetworkAdapter -CimSession $SecondNodeName -ManagementOS -Name $vSwitchName -NewName Management
186183

187184
#add SMB vNICs and configure IP
188185
foreach ($Server in ($FirstNodeName,$SecondNodeName)){
@@ -195,7 +192,7 @@
195192
Add-VMNetworkAdapter -ManagementOS -Name "SMB$TwoDigitNumber" -SwitchName $vSwitchName -CimSession $Server
196193
}
197194

198-
#assign IP Adresses
195+
#assign IP Addresses
199196
foreach ($number in (1..$SMBvNICsCount)){
200197
$TwoDigitNumber="{0:D2}" -f $Number
201198
if ($number % 2 -eq 1){
@@ -349,15 +346,16 @@
349346
#endregion
350347

351348
#region configure pool fault domain to be Storage Scale Unit and create new volume
352-
#config
349+
#Config
353350
$ClusterName="Exp-Cluster"
354351
$VolumeFriendlyName="TwoNodesMirror"
352+
$VolumeSize=1TB
355353

356354
#configure storage pool
357355
Set-StoragePool -CimSession $ClusterName -FriendlyName "S2D on $ClusterName" -FaultDomainAwarenessDefault StorageScaleUnit
358356

359357
#create new volume
360-
New-Volume -CimSession $ClusterName -StoragePoolFriendlyName "S2D on $ClusterName" -FriendlyName $VolumeFriendlyName -Size 1TB -ProvisioningType Thin
358+
New-Volume -CimSession $ClusterName -StoragePoolFriendlyName "S2D on $ClusterName" -FriendlyName $VolumeFriendlyName -Size $VolumeSize -ProvisioningType Thin
361359

362360
#validate volume fault domain awareness
363361
Get-VirtualDisk -CimSession $ClusterName | Select-Object FriendlyName,FaultDomainAwareness
@@ -370,7 +368,7 @@
370368
#delete performance history including volume (without invoking it returned error "get-srpartnership : The WS-Management service cannot process the request. The CIM namespace")
371369
Invoke-Command -ComputerName $CLusterName -ScriptBlock {Stop-ClusterPerformanceHistory -DeleteHistory}
372370
#recreate performance history
373-
Start-ClusterPerformanceHistory -cimsession $ClusterName
371+
Start-ClusterPerformanceHistory -CimSession $ClusterName
374372

375373
#validate volume fault domain awareness again (takes some time to recreate volume)
376374
Get-VirtualDisk -CimSession $ClusterName | Select-Object FriendlyName,FaultDomainAwareness
@@ -393,7 +391,7 @@
393391
#region expand cluster (2node->3node, or more)
394392
#region install roles and features on third node
395393
#Config
396-
$Servers="Exp3"
394+
$Servers="Exp3"#,"Exp4"
397395
# Install features on server(s)
398396
Invoke-Command -computername $Servers -ScriptBlock {
399397
Enable-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V -Online -NoRestart
@@ -413,7 +411,7 @@
413411
#region configure networking (assuming scalable, converged networking).
414412
#Direct connectivity would be bit different, but since we will add 3rd node and simulating direct connectivity in MSLab would add another layer of complexity, I decided to demonstrate converged
415413
#Config
416-
$Servers="Exp3"
414+
$Servers="Exp3"#,"Exp4"
417415
$ClusterName="Exp-Cluster"
418416
$vSwitchName="vSwitch"
419417
$IP=3 #start IP
@@ -527,15 +525,16 @@
527525
#region add cluster member(s)
528526
#Config
529527
$ClusterName="Exp-Cluster"
530-
$ClusterNodeNames="Exp3"
528+
$ClusterNodeNames="Exp3"#,"Exp4"
531529
#add node
532530
Add-ClusterNode -Name $ClusterNodeNames -Cluster $ClusterName
533531
#endregion
534532

535-
#region configure ResiliencySettingNameDefault to have 3 data copies and create 3 way mirror volume
533+
#region configure ResiliencySettingNameDefault to have 3 data copies and create 3-way mirror volume
536534
#config
537535
$ClusterName="Exp-Cluster"
538536
$VolumeFriendlyName="Three+NodesMirror"
537+
$VolumeSize=1TB
539538

540539
#check configuration of mirror resiliency setting (notice 2 data copies)
541540
Get-StoragePool -CimSession $ClusterName -FriendlyName "S2D on $ClusterName" | get-resiliencysetting
@@ -547,7 +546,7 @@
547546
Get-StoragePool -CimSession $ClusterName -FriendlyName "S2D on $ClusterName" | get-resiliencysetting -Name Mirror
548547

549548
#create new volume
550-
New-Volume -CimSession $ClusterName -StoragePoolFriendlyName "S2D on $ClusterName" -FriendlyName $VolumeFriendlyName -Size 1TB -ProvisioningType Thin
549+
New-Volume -CimSession $ClusterName -StoragePoolFriendlyName "S2D on $ClusterName" -FriendlyName $VolumeFriendlyName -Size $VolumeSize -ProvisioningType Thin
551550

552551
#validate volume resiliency
553552
Get-VirtualDisk -CimSession $ClusterName | Select-Object FriendlyName,NumberOfDataCopies
@@ -560,7 +559,7 @@
560559
#delete performance history including volume (without invoking it returned error "get-srpartnership : The WS-Management service cannot process the request. The CIM namespace")
561560
Invoke-Command -ComputerName $CLusterName -ScriptBlock {Stop-ClusterPerformanceHistory -DeleteHistory}
562561
#recreate performance history
563-
Start-ClusterPerformanceHistory -cimsession $ClusterName
562+
Start-ClusterPerformanceHistory -CimSession $ClusterName
564563

565564
#validate volume resiliency again (takes some time to recreate volume)
566565
Get-VirtualDisk -CimSession $ClusterName | Select-Object FriendlyName,NumberOfDataCopies
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
$LabConfig=@{AllowedVLANs="1-10,711-719" ; DomainAdminName='LabAdmin'; AdminPassword='LS1setup!' ; DCEdition='4'; Internet=$true; TelemetryLevel='Full' ; TelemetryNickname='' ; AdditionalNetworksConfig=@(); VMs=@(); CustomDnsForwarders="10.8.8.8","10.7.7.7"}
2+
3+
#Azure Stack HCI 22H2
4+
#labconfig will not domain join VMs, will add "Tools disk" and will also execute powershell command to make this tools disk online.
5+
1..4 | ForEach-Object {$LABConfig.VMs += @{ VMName = "ASNode$_" ; Configuration = 'S2D' ; ParentVHD = 'AzSHCI22H2_G2.vhdx' ; HDDNumber = 4 ; HDDSize= 2TB ; MemoryStartupBytes= 1GB; VMProcessorCount=4 ; vTPM=$true ; AddToolsVHD=$True ; Unattend="NoDjoin" }}
6+
#labconfig for nested virtualization
7+
#1..4 | ForEach-Object {$LABConfig.VMs += @{ VMName = "ASNode$_" ; Configuration = 'S2D' ; ParentVHD = 'AzSHCI22H2_G2.vhdx' ; HDDNumber = 4 ; HDDSize= 2TB ; MemoryStartupBytes= 6GB; VMProcessorCount=4 ; vTPM=$true ; AddToolsVHD=$True ; Unattend="NoDjoin" ; NestedVirt=$true }}
8+
9+
#Windows Admin Center in GW mode
10+
$LabConfig.VMs += @{ VMName = 'WACGW' ; ParentVHD = 'Win2022Core_G2.vhdx'; MGMTNICs=1}
11+
12+
#Management machine
13+
$LabConfig.VMs += @{ VMName = 'Management' ; ParentVHD = 'Win2022_G2.vhdx'; MGMTNICs=1 ; AddToolsVHD=$True }

0 commit comments

Comments
 (0)