@@ -62,8 +62,6 @@ if ($enableDetailedLoggingString -ne "true")
6262 $enableDetailedLoggingString = " false"
6363}
6464
65- $isAgentVersion97 = ((gcm Register-Environment ).Parameters.ContainsKey(" Persist" ));
66-
6765# Telemetry
6866
6967$telemetryCodes =
@@ -131,26 +129,12 @@ function Get-ResourceWinRmConfig
131129 $winrmPortToUse = ' '
132130 $protocolToUse = ' '
133131
134- if (-not $isAgentVersion97 )
135- {
136- Write-Verbose " Starting Get-Environment cmdlet call on environment name: $environmentName "
137- $environment = Get-Environment - environmentName $environmentName - TaskContext $distributedTaskContext
138- Write-Verbose " Completed Get-Environment cmdlet call on environment name: $environmentName "
139- }
140-
141132 if ($protocol -eq " HTTPS" )
142133 {
143134 $protocolToUse = $useHttpsProtocolOption
144135
145136 Write-Verbose " Starting Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceWinRMHttpsPortKeyName "
146- if ($isAgentVersion97 )
147- {
148- $winrmPortToUse = Get-EnvironmentProperty - Environment $environment - Key $resourceWinRMHttpsPortKeyName - ResourceId $resourceId
149- }
150- else
151- {
152- $winrmPortToUse = Get-EnvironmentProperty - EnvironmentName $environmentName - Key $resourceWinRMHttpsPortKeyName - TaskContext $distributedTaskContext - ResourceId $resourceId
153- }
137+ $winrmPortToUse = Get-EnvironmentProperty - Environment $environment - Key $resourceWinRMHttpsPortKeyName - ResourceId $resourceId
154138 Write-Verbose " Completed Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceWinRMHttpsPortKeyName "
155139
156140 if ([string ]::IsNullOrWhiteSpace($winrmPortToUse ))
@@ -164,14 +148,7 @@ function Get-ResourceWinRmConfig
164148 $protocolToUse = $useHttpProtocolOption
165149
166150 Write-Verbose " Starting Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceWinRMHttpPortKeyName "
167- if ($isAgentVersion97 )
168- {
169- $winrmPortToUse = Get-EnvironmentProperty - Environment $environment - Key $resourceWinRMHttpPortKeyName - ResourceId $resourceId
170- }
171- else
172- {
173- $winrmPortToUse = Get-EnvironmentProperty - EnvironmentName $environmentName - Key $resourceWinRMHttpPortKeyName - TaskContext $distributedTaskContext - ResourceId $resourceId
174- }
151+ $winrmPortToUse = Get-EnvironmentProperty - Environment $environment - Key $resourceWinRMHttpPortKeyName - ResourceId $resourceId
175152 Write-Verbose " Completed Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceWinRMHttpPortKeyName "
176153
177154 if ([string ]::IsNullOrWhiteSpace($winrmPortToUse ))
@@ -186,29 +163,15 @@ function Get-ResourceWinRmConfig
186163 Write-Verbose " `t Environment is not standerd environment. Https port has higher precedence"
187164
188165 Write-Verbose " Starting Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceWinRMHttpsPortKeyName "
189- if ($isAgentVersion97 )
190- {
191- $winrmHttpsPort = Get-EnvironmentProperty - Environment $environment - Key $resourceWinRMHttpsPortKeyName - ResourceId $resourceId
192- }
193- else
194- {
195- $winrmHttpsPort = Get-EnvironmentProperty - EnvironmentName $environmentName - Key $resourceWinRMHttpsPortKeyName - TaskContext $distributedTaskContext - ResourceId $resourceId
196- }
166+ $winrmHttpsPort = Get-EnvironmentProperty - Environment $environment - Key $resourceWinRMHttpsPortKeyName - ResourceId $resourceId
197167 Write-Verbose " Completed Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceWinRMHttpsPortKeyName "
198168
199169 if ([string ]::IsNullOrEmpty($winrmHttpsPort ))
200170 {
201171 Write-Verbose " `t Resource: $resourceName does not have any winrm https port defined, checking for winrm http port"
202172
203173 Write-Verbose " Starting Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceWinRMHttpPortKeyName "
204- if ($isAgentVersion97 )
205- {
206- $winrmHttpPort = Get-EnvironmentProperty - Environment $environment - Key $resourceWinRMHttpPortKeyName - ResourceId $resourceId
207- }
208- else
209- {
210- $winrmHttpPort = Get-EnvironmentProperty - EnvironmentName $environmentName - Key $resourceWinRMHttpPortKeyName - TaskContext $distributedTaskContext - ResourceId $resourceId
211- }
174+ $winrmHttpPort = Get-EnvironmentProperty - Environment $environment - Key $resourceWinRMHttpPortKeyName - ResourceId $resourceId
212175 Write-Verbose " Completed Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceWinRMHttpPortKeyName "
213176
214177 if ([string ]::IsNullOrEmpty($winrmHttpPort ))
@@ -235,29 +198,15 @@ function Get-ResourceWinRmConfig
235198 Write-Verbose " `t Environment is standerd environment. Http port has higher precedence"
236199
237200 Write-Verbose " Starting Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceWinRMHttpPortKeyName "
238- if ($isAgentVersion97 )
239- {
240- $winrmHttpPort = Get-EnvironmentProperty - Environment $environment - Key $resourceWinRMHttpPortKeyName - ResourceId $resourceId
241- }
242- else
243- {
244- $winrmHttpPort = Get-EnvironmentProperty - EnvironmentName $environmentName - Key $resourceWinRMHttpPortKeyName - TaskContext $distributedTaskContext - ResourceId $resourceId
245- }
201+ $winrmHttpPort = Get-EnvironmentProperty - Environment $environment - Key $resourceWinRMHttpPortKeyName - ResourceId $resourceId
246202 Write-Verbose " Completed Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceWinRMHttpPortKeyName "
247203
248204 if ([string ]::IsNullOrEmpty($winrmHttpPort ))
249205 {
250206 Write-Verbose " `t Resource: $resourceName does not have any winrm http port defined, checking for winrm https port"
251207
252208 Write-Verbose " Starting Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceWinRMHttpsPortKeyName "
253- if ($isAgentVersion97 )
254- {
255- $winrmHttpsPort = Get-EnvironmentProperty - Environment $environment - Key $resourceWinRMHttpsPortKeyName - ResourceId $resourceId
256- }
257- else
258- {
259- $winrmHttpsPort = Get-EnvironmentProperty - EnvironmentName $environmentName - Key $resourceWinRMHttpsPortKeyName - TaskContext $distributedTaskContext - ResourceId $resourceId
260- }
209+ $winrmHttpsPort = Get-EnvironmentProperty - Environment $environment - Key $resourceWinRMHttpsPortKeyName - ResourceId $resourceId
261210 Write-Verbose " Completed Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceWinRMHttpsPortKeyName "
262211
263212 if ([string ]::IsNullOrEmpty($winrmHttpsPort ))
@@ -300,14 +249,7 @@ function Get-SkipCACheckOption
300249
301250 # get skipCACheck option from environment
302251 Write-Verbose " Starting Get-EnvironmentProperty cmdlet call on environment name: $environmentName with key: $skipCACheckKeyName "
303- if ($isAgentVersion97 )
304- {
305- $skipCACheckBool = Get-EnvironmentProperty - Environment $environment - Key $skipCACheckKeyName
306- }
307- else
308- {
309- $skipCACheckBool = Get-EnvironmentProperty - EnvironmentName $environmentName - Key $skipCACheckKeyName - TaskContext $distributedTaskContext
310- }
252+ $skipCACheckBool = Get-EnvironmentProperty - Environment $environment - Key $skipCACheckKeyName
311253 Write-Verbose " Completed Get-EnvironmentProperty cmdlet call on environment name: $environmentName with key: $skipCACheckKeyName "
312254
313255 if ($skipCACheckBool -eq " true" )
@@ -327,14 +269,7 @@ function Get-ResourceConnectionDetails
327269 $resourceId = $resource.Id
328270
329271 Write-Verbose " Starting Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceFQDNKeyName "
330- if ($isAgentVersion97 )
331- {
332- $fqdn = Get-EnvironmentProperty - Environment $environment - Key $resourceFQDNKeyName - ResourceId $resourceId
333- }
334- else
335- {
336- $fqdn = Get-EnvironmentProperty - EnvironmentName $environmentName - Key $resourceFQDNKeyName - TaskContext $distributedTaskContext - ResourceId $resourceId
337- }
272+ $fqdn = Get-EnvironmentProperty - Environment $environment - Key $resourceFQDNKeyName - ResourceId $resourceId
338273 Write-Verbose " Completed Get-EnvironmentProperty cmdlet call on environment name: $environmentName with resource id: $resourceId (Name : $resourceName ) and key: $resourceFQDNKeyName "
339274
340275 $winrmconfig = Get-ResourceWinRmConfig - resourceName $resourceName - resourceId $resourceId
376311 Write-Verbose " Completed Register-Environment cmdlet call for environment : $environmentName "
377312
378313 Write-Verbose " Starting Get-EnvironmentResources cmdlet call on environment name: $environmentName "
379- if ($isAgentVersion97 )
380- {
381- $resources = Get-EnvironmentResources - Environment $environment
382- }
383- else
384- {
385- $resources = Get-EnvironmentResources - EnvironmentName $environmentName - TaskContext $distributedTaskContext
386- }
314+ $resources = Get-EnvironmentResources - Environment $environment
315+
387316 if ($resources.Count -eq 0 )
388317 {
389318 Write-TaskSpecificTelemetry " PREREQ_NoResources"
0 commit comments