Skip to content

Commit 9f808bf

Browse files
committed
fix bearer token
1 parent 5732687 commit 9f808bf

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

.pipelines/DSC-Official.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,19 @@ extends:
125125
displayName: Install Rust
126126
env:
127127
ob_restore_phase: true
128-
- task: CargoAuthenticate@0
128+
- task: AzureCLI@2
129129
inputs:
130-
configFile: "$(Build.SourcesDirectory)/DSC/.cargo/config.toml"
131-
cargoServiceConnections: azDO-Cargo-PowerShell-feed-Ingestion
132-
displayName: Authenticating cargo crates registry
130+
azureSubscription: az-PowerShell-feed-ingestion
131+
scriptType: 'pscore'
132+
scriptLocation: 'inlineScript'
133+
inlineScript: |
134+
$accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
135+
136+
# Set the access token as a secret, so it doesn't get leaked in the logs
137+
Write-Host "##vso[task.setsecret]$accessToken"
138+
$header = "Bearer $accessToken"
139+
Write-Host "##vso[task.setvariable variable=CARGO_REGISTRIES_POWERSHELL_TOKEN;issecret=true]$header"
140+
displayName: 'Get Azure DevOps Token'
133141
env:
134142
ob_restore_phase: true
135143
- pwsh: |
@@ -261,7 +269,7 @@ extends:
261269
262270
# Set the access token as a secret, so it doesn't get leaked in the logs
263271
Write-Host "##vso[task.setsecret]$accessToken"
264-
$header = Bearer $accessToken
272+
$header = "Bearer $accessToken"
265273
Write-Host "##vso[task.setvariable variable=CARGO_REGISTRIES_POWERSHELL_TOKEN;issecret=true]$header"
266274
displayName: 'Get Azure DevOps Token'
267275
env:
@@ -305,7 +313,7 @@ extends:
305313
306314
# Set the access token as a secret, so it doesn't get leaked in the logs
307315
Write-Host "##vso[task.setsecret]$accessToken"
308-
$header = Bearer $accessToken
316+
$header = "Bearer $accessToken"
309317
Write-Host "##vso[task.setvariable variable=CARGO_REGISTRIES_POWERSHELL_TOKEN;issecret=true]$header"
310318
displayName: 'Get Azure DevOps Token'
311319
env:
@@ -347,11 +355,19 @@ extends:
347355
displayName: Install Rust
348356
env:
349357
ob_restore_phase: true
350-
- task: CargoAuthenticate@0
358+
- task: AzureCLI@2
351359
inputs:
352-
configFile: ".cargo/config.toml"
353-
cargoServiceConnections: azDO-Cargo-PowerShell-feed-Ingestion
354-
displayName: Authenticating cargo crates registry
360+
azureSubscription: az-PowerShell-feed-ingestion
361+
scriptType: 'pscore'
362+
scriptLocation: 'inlineScript'
363+
inlineScript: |
364+
$accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
365+
366+
# Set the access token as a secret, so it doesn't get leaked in the logs
367+
Write-Host "##vso[task.setsecret]$accessToken"
368+
$header = "Bearer $accessToken"
369+
Write-Host "##vso[task.setvariable variable=CARGO_REGISTRIES_POWERSHELL_TOKEN;issecret=true]$header"
370+
displayName: 'Get Azure DevOps Token'
355371
env:
356372
ob_restore_phase: true
357373
- pwsh: |

0 commit comments

Comments
 (0)