Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Create-BasicAuthHeader {
- Param(
- [Parameter(Mandatory=$true)]
- [string]$Name,
- [Parameter(Mandatory=$true)]
- [string]$PAT
- )
- $Auth = '{0}:{1}' -f $Name, $PAT
- $Auth = [System.Text.Encoding]::UTF8.GetBytes($Auth)
- $Auth = [System.Convert]::ToBase64String($Auth)
- $Header = @{Authorization=("Basic {0}" -f $Auth)}
- $Header
- }
- Invoke-WebRequest -Uri 'https://dev.azure.com/<organisation name>/_apis/projects' -Headers (Create-BasicAuthHeader 'Azure TOKEN_NAME' '<personal access token>') -Method Get
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement