@@ -7,21 +7,35 @@ Creates a 1ES Hosted Pool, set up for the STL's CI.
77
88. DESCRIPTION
99See https://github.com/microsoft/STL/wiki/Checklist-for-Toolset-Updates for more information.
10+
11+ . PARAMETER Arch
12+ The architecture can be either x64 or arm64.
1013#>
14+ [CmdletBinding (PositionalBinding = $false )]
15+ Param (
16+ [Parameter (Mandatory )][ValidateSet (' x64' , ' arm64' )][String ]$Arch
17+ )
1118
1219$ErrorActionPreference = ' Stop'
1320
1421$CurrentDate = Get-Date
1522$Timestamp = $CurrentDate.ToString (' yyyy-MM-ddTHHmm' )
16- $Arch = ' x64'
1723
1824$Location = ' eastus2'
19- $VMSize = ' Standard_F32as_v6'
20- $PoolSize = 64
25+
26+ if ($Arch -ieq ' x64' ) {
27+ $VMSize = ' Standard_F32as_v6'
28+ $PoolSize = 64
29+ $ImagePublisher = ' MicrosoftWindowsServer'
30+ $ImageOffer = ' WindowsServer'
31+ $ImageSku = ' 2025-datacenter-azure-edition'
32+ } else {
33+ $VMSize = ' Standard_D32ps_v6'
34+ $PoolSize = 32
35+ $ImageId = ' /SharedGalleries/WindowsServer.1P/Images/2025-datacenter-azure-edition-arm64/Versions/latest'
36+ }
37+
2138$ProtoVMName = ' PROTOTYPE'
22- $ImagePublisher = ' MicrosoftWindowsServer'
23- $ImageOffer = ' WindowsServer'
24- $ImageSku = ' 2025-datacenter-azure-edition'
2539
2640$LogFile = " 1es-hosted-pool-$Timestamp -$Arch .log"
2741$ProgressActivity = ' Preparing STL CI pool'
@@ -178,12 +192,21 @@ $Nic = New-AzNetworkInterface `
178192# ###################################################################################################
179193Display- ProgressBar - Status ' Creating prototype VM config'
180194
181- # Previously: -Priority 'Spot'
182- $VM = New-AzVMConfig `
183- - VMName $ProtoVMName `
184- - VMSize $VMSize `
185- - DiskControllerType ' NVMe' `
186- - Priority ' Regular'
195+ if ($Arch -ieq ' x64' ) {
196+ $VM = New-AzVMConfig `
197+ - VMName $ProtoVMName `
198+ - VMSize $VMSize `
199+ - DiskControllerType ' NVMe' `
200+ - Priority ' Regular'
201+ } else {
202+ $VM = New-AzVMConfig `
203+ - VMName $ProtoVMName `
204+ - VMSize $VMSize `
205+ - DiskControllerType ' SCSI' `
206+ - Priority ' Regular' `
207+ - SecurityType ' TrustedLaunch' `
208+ - SharedGalleryImageId $ImageId
209+ }
187210
188211# ###################################################################################################
189212Display- ProgressBar - Status ' Setting prototype VM OS'
@@ -205,12 +228,16 @@ $VM = Add-AzVMNetworkInterface `
205228# ###################################################################################################
206229Display- ProgressBar - Status ' Setting prototype VM source image'
207230
208- $VM = Set-AzVMSourceImage `
209- - VM $VM `
210- - PublisherName $ImagePublisher `
211- - Offer $ImageOffer `
212- - Skus $ImageSku `
213- - Version ' latest'
231+ if ($Arch -ieq ' x64' ) {
232+ $VM = Set-AzVMSourceImage `
233+ - VM $VM `
234+ - PublisherName $ImagePublisher `
235+ - Offer $ImageOffer `
236+ - Skus $ImageSku `
237+ - Version ' latest'
238+ } else {
239+ # We passed -SharedGalleryImageId to New-AzVMConfig above.
240+ }
214241
215242# ###################################################################################################
216243Display- ProgressBar - Status ' Setting prototype VM boot diagnostic'
@@ -242,7 +269,8 @@ Display-ProgressBar -Status 'Running provision-image.ps1 in VM'
242269$ProvisionImageResult = Invoke-AzVMRunCommand `
243270 - ResourceId $VM.ID `
244271 - CommandId ' RunPowerShellScript' `
245- - ScriptPath " $PSScriptRoot \provision-image.ps1"
272+ - ScriptPath " $PSScriptRoot \provision-image.ps1" `
273+ - Parameter @ { ' Arch' = $Arch ; }
246274
247275Write-Host $ProvisionImageResult.value.Message
248276
@@ -322,7 +350,11 @@ Display-ProgressBar -Status 'Creating image definition'
322350
323351$ImageDefinitionName = " $ResourceGroupName -ImageDefinition"
324352$FeatureTrustedLaunch = @ { Name = ' SecurityType' ; Value = ' TrustedLaunch' ; }
325- $FeatureNVMe = @ { Name = ' DiskControllerTypes' ; Value = ' SCSI, NVMe' ; }
353+ if ($Arch -ieq ' x64' ) {
354+ $FeatureNVMe = @ { Name = ' DiskControllerTypes' ; Value = ' SCSI, NVMe' ; }
355+ } else {
356+ $FeatureNVMe = @ { Name = ' DiskControllerTypes' ; Value = ' SCSI' ; }
357+ }
326358$ImageDefinitionFeatures = @ ($FeatureTrustedLaunch , $FeatureNVMe )
327359New-AzGalleryImageDefinition `
328360 - Location $Location `
@@ -331,9 +363,10 @@ New-AzGalleryImageDefinition `
331363 - Name $ImageDefinitionName `
332364 - OsState ' Generalized' `
333365 - OsType ' Windows' `
334- - Publisher $ImagePublisher `
335- - Offer $ImageOffer `
336- - Sku $ImageSku `
366+ - Publisher ' StlPublisher' `
367+ - Offer ' StlOffer' `
368+ - Sku ' StlSku' `
369+ - Architecture $Arch `
337370 - Feature $ImageDefinitionFeatures `
338371 - HyperVGeneration ' V2' >> $LogFile
339372
0 commit comments