@@ -43,19 +43,23 @@ parameters:
4343
4444steps :
4545- ${{ if and(eq(variables['System.TeamProject'], parameters.internalProjectName), ne(variables['Build.Reason'], 'PullRequest')) }} :
46+ # Guard on .name: null parameters passed through template layers can become
47+ # empty objects that are truthy, so check the concrete property instead.
4648 - ${{ each serviceConnection in parameters.serviceConnections }} :
47- - task : AzureCLI@2
48- displayName : Reference ${{ serviceConnection.name }}
49- inputs :
50- azureSubscription : ${{ serviceConnection.name }}
51- ${{ if eq(parameters.dockerClientOS, 'windows') }} :
52- scriptType : ps
53- ${{ else }} :
54- scriptType : pscore
55- scriptLocation : inlineScript
56- inlineScript : Write-Host "Service connection referenced for OIDC"
49+ - ${{ if serviceConnection.name }} :
50+ - task : AzureCLI@2
51+ displayName : Reference ${{ serviceConnection.name }}
52+ inputs :
53+ azureSubscription : ${{ serviceConnection.name }}
54+ ${{ if eq(parameters.dockerClientOS, 'windows') }} :
55+ scriptType : ps
56+ ${{ else }} :
57+ scriptType : pscore
58+ scriptLocation : inlineScript
59+ inlineScript : Write-Host "Service connection referenced for OIDC"
5760 - ${{ each auth in parameters.publishConfig.RegistryAuthentication }} :
58- - ${{ if containsValue(parameters.usesRegistries, auth.server) }} :
61+ # Also guard on .name here for the same reason as the serviceConnections loop above.
62+ - ${{ if and(containsValue(parameters.usesRegistries, auth.server), auth.serviceConnection.name) }} :
5963 - task : AzureCLI@2
6064 displayName : Reference ${{ auth.serviceConnection.name }}
6165 inputs :
0 commit comments