@@ -16,7 +16,7 @@ $verboseLog = Get-VstsInput -Name 'verbose' -AsBool
16
16
$helperHybridWorkerModuleManagement = Get-VstsInput - Name ' helperHybridWorkerModuleManagement' - AsBool
17
17
18
18
if ($verboseLog ) {
19
- Write-host " Verose log will be enabled"
19
+ Write-host " Verbose log will be enabled"
20
20
$VerbosePreference = ' Continue'
21
21
}
22
22
Write-Host " Full sync set to $fullSync "
@@ -57,9 +57,8 @@ Write-Host "Import succeeded!"
57
57
Write-Host " Starting process..."
58
58
# retrieve service connection object
59
59
$serviceConnection = Get-VstsEndpoint - Name $azureSubscription - Require
60
- $serviceConnectionSerialized = ConvertTo-Json $serviceConnection
61
60
62
- # define type od service connection
61
+ # we support service principal with client secret or certificate, MSI, and workload identity federation
63
62
switch ($serviceConnection.auth.scheme ) {
64
63
' ServicePrincipal' {
65
64
# get service connection object properties
@@ -113,10 +112,7 @@ switch ($serviceConnection.auth.scheme) {
113
112
114
113
Write-Verbose " Getting access token for service connection"
115
114
$vstsEndpoint = Get-VstsEndpoint - Name SystemVssConnection - Require
116
- Write-Verbose " VSTS endpoint: `n $ ( $vstsEndpoint | ConvertTo-Json - Depth 99 | Out-String ) "
117
115
$vstsAccessToken = $vstsEndpoint.auth.parameters.AccessToken
118
- $servicePrincipalId = $vstsEndpoint.auth.parameters.serviceprincipalid
119
- $tenantId = $vstsEndpoint.auth.parameters.tenantid
120
116
121
117
$url = " $uri /$projectId /_apis/distributedtask/hubs/$hub /plans/$planId /jobs/$jobId /oidctoken?serviceConnectionId=$serviceConnectionId `&api-version=7.2-preview.1"
122
118
@@ -127,11 +123,11 @@ switch ($serviceConnection.auth.scheme) {
127
123
Write-Verbose " Getting OIDC token from VSTS on uri: $url "
128
124
$response = Invoke-RestMethod - Uri $url - Method Post - Headers @ { " Authorization" = (" Basic {0}" -f $base64AuthInfo ) } - ContentType " application/json"
129
125
130
- Write-Verbose ($response | ConvertTo-Json - Depth 99 | Out-String )
131
- $oidcToken = $response.oidcToken
132
- $assertion = $oidcToken
126
+ $assertion = $response.oidcToken
133
127
134
- Write-verbose " Initializing AAD factory with assertion $assertion for tenant $tenantId "
128
+ $servicePrincipalId = $serviceConnection.auth.parameters.serviceprincipalid
129
+ $tenantId = $serviceConnection.auth.parameters.tenantid
130
+ Write-verbose " Initializing AAD factory with clientId $servicePrincipalId for tenant $tenantId "
135
131
Initialize-AadAuthenticationFactory `
136
132
- servicePrincipalId $servicePrincipalId `
137
133
- assertion $assertion `
0 commit comments