@@ -119,28 +119,6 @@ param (
119119
120120. $PSScriptRoot / SubConfig- Helpers.ps1
121121
122- $azsdkPipelineVnetWestUS = ' /subscriptions/a18897a6-7e44-457d-9260-f2854c0aca42/resourceGroups/azsdk-pools/providers/Microsoft.Network/virtualNetworks/azsdk-pipeline-vnet-wus'
123- $azsdkPipelineVnetCanadaCentral = ' /subscriptions/a18897a6-7e44-457d-9260-f2854c0aca42/resourceGroups/azsdk-pools/providers/Microsoft.Network/virtualNetworks/azsdk-pipeline-vnet-cnc'
124- $azsdkPipelineSubnetMap = @ {
125- ' azsdk-pool-mms-ubuntu-1804-general' = ($azsdkPipelineVnetWestUS + ' /subnets/pipeline-subnet-ubuntu-1804-general' )
126- ' azsdk-pool-mms-ubuntu-2004-general' = ($azsdkPipelineVnetWestUS + ' /subnets/pipeline-subnet-ubuntu-2004-general' )
127- ' azsdk-pool-mms-ubuntu-2204-general' = ($azsdkPipelineVnetWestUS + ' /subnets/pipeline-subnet-ubuntu-2204-general' )
128- ' azsdk-pool-mms-win-2019-general' = ($azsdkPipelineVnetWestUS + ' /subnets/pipeline-subnet-win-2019-general' )
129- ' azsdk-pool-mms-win-2022-general' = ($azsdkPipelineVnetWestUS + ' /subnets/pipeline-subnet-win-2022-general' )
130- ' azsdk-pool-mms-ubuntu-1804-storage' = ($azsdkPipelineVnetCanadaCentral + ' /subnets/pipeline-subnet-ubuntu-1804-storage' )
131- ' azsdk-pool-mms-ubuntu-2004-storage' = ($azsdkPipelineVnetCanadaCentral + ' /subnets/pipeline-subnet-ubuntu-2004-storage' )
132- ' azsdk-pool-mms-win-2019-storage' = ($azsdkPipelineVnetCanadaCentral + ' /subnets/pipeline-subnet-win-2019-storage' )
133- ' azsdk-pool-mms-win-2022-storage' = ($azsdkPipelineVnetCanadaCentral + ' /subnets/pipeline-subnet-win-2022-storage' )
134- ' Azure Pipelines' = ' '
135- }
136-
137- $poolSubnet = ' '
138- if ($env: Pool ) {
139- $poolSubnet = $azsdkPipelineSubnetMap [$env: Pool ]
140- } else {
141- Write-Warning " Pool environment variable is not defined! Subnet allowlisting will not work and live test resources may be non-compliant."
142- }
143-
144122if (! $ServicePrincipalAuth ) {
145123 # Clear secrets if not using Service Principal auth. This prevents secrets
146124 # from being passed to pre- and post-scripts.
@@ -785,8 +763,8 @@ try {
785763 $templateParameters.Add (' testApplicationSecret' , $TestApplicationSecret )
786764 }
787765 # Only add subnets when running in an azure pipeline context
788- if ($CI -and $Environment -eq ' AzureCloud' -and $poolSubnet ) {
789- $templateParameters.Add (' azsdkPipelineSubnetList' , @ ($poolSubnet ))
766+ if ($CI -and $Environment -eq ' AzureCloud' -and $env: PoolSubnet ) {
767+ $templateParameters.Add (' azsdkPipelineSubnetList' , @ ($env: PoolSubnet ))
790768 }
791769
792770 $defaultCloudParameters = LoadCloudConfig $Environment
@@ -873,9 +851,9 @@ try {
873851 if ($rules -and $rules.DefaultAction -eq " Allow" ) {
874852 Write-Host " Restricting network rules in storage account '$ ( $account.Name ) ' to deny access by default"
875853 Retry { Update-AzStorageAccountNetworkRuleSet - ResourceGroupName $ResourceGroupName - Name $account.Name - DefaultAction Deny }
876- if ($CI -and $poolSubnet ) {
877- Write-Host " Enabling access to '$ ( $account.Name ) ' from pipeline subnet $poolSubnet "
878- Retry { Add-AzStorageAccountNetworkRule - ResourceGroupName $ResourceGroupName - Name $account.Name - VirtualNetworkResourceId $poolSubnet }
854+ if ($CI -and $env: PoolSubnet ) {
855+ Write-Host " Enabling access to '$ ( $account.Name ) ' from pipeline subnet $ ( $ env: PoolSubnet ) "
856+ Retry { Add-AzStorageAccountNetworkRule - ResourceGroupName $ResourceGroupName - Name $account.Name - VirtualNetworkResourceId $env: PoolSubnet }
879857 } elseif ($AllowIpRanges ) {
880858 Write-Host " Enabling access to '$ ( $account.Name ) ' to $ ( $AllowIpRanges.Length ) IP ranges"
881859 $ipRanges = $AllowIpRanges | ForEach-Object {
0 commit comments