Skip to content

Instantly share code, notes, and snippets.

@FrankDeGroot
Created September 23, 2025 11:30
Show Gist options
  • Save FrankDeGroot/f48e64ecda0c890bea49ed3dbbdb9ebf to your computer and use it in GitHub Desktop.
Save FrankDeGroot/f48e64ecda0c890bea49ed3dbbdb9ebf to your computer and use it in GitHub Desktop.
steps:
- task: AzureCLI@2
name: getSpnDetails
inputs:
azureSubscription: ${{parameters.AzureDevOpsServiceConnection}}
scriptType: pscore
scriptLocation: inlineScript
addSpnToEnvironment: true
inlineScript: |
Write-Host "##vso[task.setvariable variable=serviceConnectionClientId;secret]$($env:servicePrincipalId)"
Write-Host "##vso[task.setvariable variable=serviceConnectionObjectId;secret]$(az ad sp show --id $env:servicePrincipalId --query id --output tsv)"
@FrankDeGroot
Copy link
Author

Use Client ID / App ID / SPN ID to authenticate
Use Object ID to assign RBAC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment