Unable to trigger Azure Devops REST API

Copper Contributor

Below is my code:

 

 

 

$TenantId = ""
$ClientId = " "  # aka Application ID
$ClientSecret = " "  # aka key

$Resource = "https://app.vssps.visualstudio.com"
$RequestAccessTokenUri = "https://login.microsoftonline.com/<<tenantid>>/oauth2/token"


$Body = "grant_type=client_credentials&client_id=$ClientId&client_secret=$ClientSecret&resource=$Resource"
$token = Invoke-RestMethod -Method Post -Uri $RequestAccessTokenUri -Body $Body -ContentType 'application/x-www-form-urlencoded'

$bearer_token= $token.access_token

$headers = @{
    Accept = "application/json"
    Authorization = "Bearer $bearer_token"
}

$url='https://dev.azure.com/<<Org>>/<<Project>>/_apis/pipelines/17/runs?api-version=7.1-preview.1'
$x=Invoke-RestMethod -Uri $url -Method Get -Headers $headers;
$x

 

 

But I am getting the below error :

 

Microsoft Internet Explorer&#39;s Enhanced Security Configuration is currently enabled on your environment. This enhanced level of security prevents our web integration experiences from displaying or performing correctly. To continue with your operation please disable this configuration or contact your administrator.

 

Note : the app has project admin access

1 Reply

@NandanHegde15 

 

Seems related to PAT (Personal Access Token) that you to look into