@@ -34,29 +34,30 @@ steps:
3434 env:
3535 EXPORT_COMMAND: ${{ parameters.ExportCommand }}
3636
37- # We sign in once with the AzureCLI task, as it uses OIDC to obtain a
38- # temporary token. But the task also logs out, and so we save the token and
39- # use it to log in persistently (for the rest of the build).
40- - task : AzureCLI@2
41- displayName : ' Authenticate signing tools (1/2)'
42- inputs :
43- azureSubscription : ${{ parameters.AzureServiceConnectionName }}
44- scriptType : ' ps'
45- scriptLocation : ' inlineScript'
46- inlineScript : |
47- "##vso[task.setvariable variable=AZURE_CLIENT_ID;issecret=true]${env:servicePrincipalId}"
48- "##vso[task.setvariable variable=AZURE_ID_TOKEN;issecret=true]${env:idToken}"
49- "##vso[task.setvariable variable=AZURE_TENANT_ID;issecret=true]${env:tenantId}"
50- "##vso[task.setvariable variable=AZURE_TOKEN_CREDENTIALS]AzureCliCredential"
51- addSpnToEnvironment : true
37+ - ${{ if parameters.AzureServiceConnectionName }} :
38+ # We sign in once with the AzureCLI task, as it uses OIDC to obtain a
39+ # temporary token. But the task also logs out, and so we save the token and
40+ # use it to log in persistently (for the rest of the build).
41+ - task : AzureCLI@2
42+ displayName : ' Authenticate signing tools (1/2)'
43+ inputs :
44+ azureSubscription : ${{ parameters.AzureServiceConnectionName }}
45+ scriptType : ' ps'
46+ scriptLocation : ' inlineScript'
47+ inlineScript : |
48+ "##vso[task.setvariable variable=AZURE_CLIENT_ID;issecret=true]${env:servicePrincipalId}"
49+ "##vso[task.setvariable variable=AZURE_ID_TOKEN;issecret=true]${env:idToken}"
50+ "##vso[task.setvariable variable=AZURE_TENANT_ID;issecret=true]${env:tenantId}"
51+ "##vso[task.setvariable variable=AZURE_TOKEN_CREDENTIALS]AzureCliCredential"
52+ addSpnToEnvironment : true
5253
53- - powershell : >
54- az login --service-principal
55- -u $(AZURE_CLIENT_ID)
56- --tenant $(AZURE_TENANT_ID)
57- --allow-no-subscriptions
58- --federated-token $(AZURE_ID_TOKEN)
59- displayName: 'Authenticate signing tools (2/2)'
54+ - powershell : >
55+ az login --service-principal
56+ -u $(AZURE_CLIENT_ID)
57+ --tenant $(AZURE_TENANT_ID)
58+ --allow-no-subscriptions
59+ --federated-token $(AZURE_ID_TOKEN)
60+ displayName: 'Authenticate signing tools (2/2)'
6061
6162 - ${{ if parameters.Include }} :
6263 - powershell : |
0 commit comments