Azure API continuous token invalid access

2022-09-21T07:12:26.627+00:00

Trying to hit the aure API and got the results and continuous token but not ablt to pass the continuous token both from postman and powershell code Kindly let me know how to use continuous token.

$response1 = Invoke-RestMethod $URI -Method 'POST' -Headers $headerss -Body $bodyy -ContentType "application/json"
$continuationToken= $response1.continuationToken | ConvertTo-Json
$continuationToken.token
$response1.headerss.'x-ms-continuationtoken'
$continuationToken = [System.Web.HttpUtility]::UrlEncode($continuationToken)
Invoke-RestMethod -Headers @{Authorization = "Bearer $($continuationToken)"} -Uri $URI -Method 'POST' -Verbose

Invoke-RestMethod : {"error":{"code":"InvalidAuthenticationToken","message":"The access token is invalid."}}
At line:34 char:1

  • Invoke-RestMethod -Headers @{Authorization = "Bearer $($continuationT ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
  • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,452 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. 2022-09-22T03:35:23.897+00:00

    Hello @Moorthi, Sindhu - Contractor {PEP} and thanks for reaching out. In order to pass an Azure DevOps continuationToken to the next request you need to do it as a query param and not a header.

    E.g.
    https://dev.azure.com/{organization}/{project}/_apis/test/configurations?continuationToken={continuationToken}...

    Let us know if you need additional assistance. If the answer was helpful, please accept it and complete the quality survey so that others can find a solution.

    0 comments No comments