trying to get data from Azure Devops espeically from Queries

$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($personalToken)"))
$header = @{authorization = "Basic $token"}
$projectsUrl = " ~~"

$projects = Invoke-RestMethod -Uri $projectsUrl -Method Get -ContentType "application/json" -Headers $header
$projects.value | ForEach-Object {

I failed to authenticate. … what I am trying to do get the data as a json file and upload on power bi dashboard.


can you guys help me out or show me a sample codE?



Make sure you are using proper token. Do you really need to convert to Base64 ?

You do need to convert your personal access token to base64 to work with the Azure DevOps Rest API. Take a look at your $Token variable. You are trying to pass $PersonalToken not $PersonalAccessToken like you declared in the above line.