SHARE
TWEET

Untitled

Shell_Casing Jul 23rd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. function Create-BasicAuthHeader {
  4.   Param(
  5.     [Parameter(Mandatory=$true)]
  6.     [string]$Name,
  7.     [Parameter(Mandatory=$true)]
  8.     [string]$PAT
  9. )
  10.  
  11.   $Auth = '{0}:{1}' -f $Name, $PAT
  12.   $Auth = [System.Text.Encoding]::UTF8.GetBytes($Auth)
  13.   $Auth = [System.Convert]::ToBase64String($Auth)
  14.   $Header = @{Authorization=("Basic {0}" -f $Auth)}
  15.   $Header
  16. }
  17.  
  18. Invoke-WebRequest -Uri 'https://dev.azure.com/<organisation name>/_apis/projects' -Headers (Create-BasicAuthHeader 'Azure TOKEN_NAME' '<personal access token>') -Method Get
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top