@@ -12,15 +12,18 @@ See https://github.com/microsoft/STL/wiki/Checklist-for-Toolset-Updates for more
1212$ErrorActionPreference = ' Stop'
1313
1414$CurrentDate = Get-Date
15+ $Timestamp = $CurrentDate.ToString (' yyyy-MM-ddTHHmm' )
16+ $Arch = ' x64'
1517
1618$Location = ' eastus2'
1719$VMSize = ' Standard_F32as_v6'
20+ $PoolSize = 64
1821$ProtoVMName = ' PROTOTYPE'
1922$ImagePublisher = ' MicrosoftWindowsServer'
2023$ImageOffer = ' WindowsServer'
2124$ImageSku = ' 2025-datacenter-azure-edition'
2225
23- $LogFile = ' 1es-hosted-pool.log'
26+ $LogFile = " 1es-hosted-pool- $Timestamp - $Arch .log"
2427$ProgressActivity = ' Preparing STL CI pool'
2528$TotalProgress = 38
2629$CurrentProgress = 1
@@ -82,15 +85,16 @@ Update-AzConfig `
8285 - Scope ' Process' >> $LogFile
8386
8487# ###################################################################################################
85- Display- ProgressBar - Status ' Setting the subscription context'
88+ Display- ProgressBar - Status ' Getting the subscription context'
8689
87- Set-AzContext `
88- - SubscriptionName ' CPP_STL_GitHub' >> $LogFile
90+ if ((Get-AzContext ).Subscription.Name -cne ' CPP_STL_GitHub' ) {
91+ Write-Error ' Please sign in with `Connect-AzAccount -Subscription '' CPP_STL_GitHub'' ` before running this script.'
92+ }
8993
9094# ###################################################################################################
9195Display- ProgressBar - Status ' Creating resource group'
9296
93- $ResourceGroupName = ' StlBuild- ' + $CurrentDate .ToString ( ' yyyy-MM-ddTHHmm ' )
97+ $ResourceGroupName = " Stl- $Timestamp - $Arch "
9498
9599New-AzResourceGroup `
96100 - Name $ResourceGroupName `
@@ -105,7 +109,7 @@ $Credential = New-Object System.Management.Automation.PSCredential ('AdminUser',
105109# ###################################################################################################
106110Display- ProgressBar - Status ' Creating public IP address'
107111
108- $PublicIpAddressName = $ResourceGroupName + ' -PublicIpAddress'
112+ $PublicIpAddressName = " $ResourceGroupName -PublicIpAddress"
109113$PublicIpAddress = New-AzPublicIpAddress `
110114 - Name $PublicIpAddressName `
111115 - ResourceGroupName $ResourceGroupName `
@@ -116,7 +120,7 @@ $PublicIpAddress = New-AzPublicIpAddress `
116120# ###################################################################################################
117121Display- ProgressBar - Status ' Creating NAT gateway'
118122
119- $NatGatewayName = $ResourceGroupName + ' -NatGateway'
123+ $NatGatewayName = " $ResourceGroupName -NatGateway"
120124$NatGateway = New-AzNatGateway `
121125 - Name $NatGatewayName `
122126 - ResourceGroupName $ResourceGroupName `
@@ -128,7 +132,7 @@ $NatGateway = New-AzNatGateway `
128132# ###################################################################################################
129133Display- ProgressBar - Status ' Creating network security group'
130134
131- $NetworkSecurityGroupName = $ResourceGroupName + ' -NetworkSecurity'
135+ $NetworkSecurityGroupName = " $ResourceGroupName -NetworkSecurity"
132136$NetworkSecurityGroup = New-AzNetworkSecurityGroup `
133137 - Name $NetworkSecurityGroupName `
134138 - ResourceGroupName $ResourceGroupName `
@@ -137,10 +141,12 @@ $NetworkSecurityGroup = New-AzNetworkSecurityGroup `
137141# ###################################################################################################
138142Display- ProgressBar - Status ' Creating virtual network subnet config'
139143
140- # TRANSITION, 2025-09-30: "On September 30, 2025, default outbound access for new deployments will be retired."
144+ # TRANSITION, 2026-03-31: "After March 31, 2026, new virtual networks will default to using private subnets,
145+ # meaning that an explicit outbound method must be enabled in order to reach public endpoints on the Internet
146+ # and within Microsoft."
141147# https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/default-outbound-access
142148# We're using `-DefaultOutboundAccess $false` to opt-in early.
143- $SubnetName = $ResourceGroupName + ' -Subnet'
149+ $SubnetName = " $ResourceGroupName -Subnet"
144150$Subnet = New-AzVirtualNetworkSubnetConfig `
145151 - Name $SubnetName `
146152 - AddressPrefix ' 10.0.0.0/16' `
@@ -151,7 +157,7 @@ $Subnet = New-AzVirtualNetworkSubnetConfig `
151157# ###################################################################################################
152158Display- ProgressBar - Status ' Creating virtual network'
153159
154- $VirtualNetworkName = $ResourceGroupName + ' -Network'
160+ $VirtualNetworkName = " $ResourceGroupName -Network"
155161$VirtualNetwork = New-AzVirtualNetwork `
156162 - Name $VirtualNetworkName `
157163 - ResourceGroupName $ResourceGroupName `
@@ -162,7 +168,7 @@ $VirtualNetwork = New-AzVirtualNetwork `
162168# ###################################################################################################
163169Display- ProgressBar - Status ' Creating network interface'
164170
165- $NicName = $ResourceGroupName + ' -NIC'
171+ $NicName = " $ResourceGroupName -NIC"
166172$Nic = New-AzNetworkInterface `
167173 - Name $NicName `
168174 - ResourceGroupName $ResourceGroupName `
@@ -295,7 +301,7 @@ Set-AzVM `
295301# ###################################################################################################
296302Display- ProgressBar - Status ' Creating gallery'
297303
298- $GalleryName = ' StlBuild_ ' + $CurrentDate .ToString ( ' yyyy_MM_ddTHHmm ' ) + ' _Gallery '
304+ $GalleryName = " $ResourceGroupName -Gallery " -replace ' - ' , ' _ '
299305$Gallery = New-AzGallery `
300306 - Location $Location `
301307 - ResourceGroupName $ResourceGroupName `
@@ -314,7 +320,7 @@ New-AzRoleAssignment `
314320# ###################################################################################################
315321Display- ProgressBar - Status ' Creating image definition'
316322
317- $ImageDefinitionName = $ResourceGroupName + ' -ImageDefinition'
323+ $ImageDefinitionName = " $ResourceGroupName -ImageDefinition"
318324$FeatureTrustedLaunch = @ { Name = ' SecurityType' ; Value = ' TrustedLaunch' ; }
319325$FeatureNVMe = @ { Name = ' DiskControllerTypes' ; Value = ' SCSI, NVMe' ; }
320326$ImageDefinitionFeatures = @ ($FeatureTrustedLaunch , $FeatureNVMe )
@@ -352,7 +358,7 @@ Register-AzResourceProvider `
352358# ###################################################################################################
353359Display- ProgressBar - Status ' Creating 1ES image'
354360
355- $ImageName = $ResourceGroupName + ' -Image'
361+ $ImageName = " $ResourceGroupName -Image"
356362New-AzResource `
357363 - Location $Location `
358364 - ResourceGroupName $ResourceGroupName `
@@ -364,14 +370,14 @@ New-AzResource `
364370# ###################################################################################################
365371Display- ProgressBar - Status ' Creating 1ES Hosted Pool'
366372
367- $PoolName = $ResourceGroupName + ' -Pool'
373+ $PoolName = " $ResourceGroupName -Pool"
368374
369375$PoolProperties = @ {
370376 ' organization' = ' https://dev.azure.com/vclibs'
371377 ' projects' = @ (' STL' )
372378 ' sku' = @ { ' name' = $VMSize ; ' tier' = ' StandardSSD' ; ' enableSpot' = $false ; }
373379 ' images' = @ (@ { ' imageName' = $ImageName ; ' poolBufferPercentage' = ' 100' ; })
374- ' maxPoolSize' = 64
380+ ' maxPoolSize' = $PoolSize
375381 ' agentProfile' = @ { ' type' = ' Stateless' ; }
376382}
377383
0 commit comments