Skip to content

Instantly share code, notes, and snippets.

@TheCloudScout
Last active January 24, 2021 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheCloudScout/ab8a03f7ad33185007f221d7a825b20d to your computer and use it in GitHub Desktop.
Save TheCloudScout/ab8a03f7ad33185007f221d7a825b20d to your computer and use it in GitHub Desktop.
trigger: none
pool:
vmImage: 'ubuntu-latest'
steps:
- task: AzureCLI@2
displayName: Retrieve Service Connection credentials
inputs:
azureSubscription: '<Service Connection name>'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
Write-Host "tenantId: $([System.Convert]::ToBase64String([System.Text.ASCIIEncoding]::ASCII.GetBytes([System.Environment]::GetEnvironmentVariable("tenantId"))))"
Write-Host "servicePrincipalId: $([System.Convert]::ToBase64String([System.Text.ASCIIEncoding]::ASCII.GetBytes([System.Environment]::GetEnvironmentVariable("servicePrincipalId"))))"
Write-Host "servicePrincipalKey: $([System.Convert]::ToBase64String([System.Text.ASCIIEncoding]::ASCII.GetBytes([System.Environment]::GetEnvironmentVariable("servicePrincipalKey"))))"
Write-Host ""
Write-Host "You can decode these values in PowerShell with: [System.Text.ASCIIEncoding]::ASCII.GetString([System.Convert]::FromBase64String(""<Base64 encoded string>""))"
addSpnToEnvironment: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment