Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Azure Pipeline task to call Azure REST API
steps:
- powershell: |
$azuretoken=''
$subscriptionID = ''
$location = 'Japan%20East'
$method = "GET"
$apiurl = "https://management.azure.com/subscriptions/"+$subscriptionID+"/providers/Microsoft.Compute/locations/"+ $location +"/runCommands?api-version=2017-03-30"
$authHeader = "Bearer " + $azuretoken
$requestHeader = @{
"Authorization" = $authHeader
"Accept" = "application/json"
}
$contentType = "application/json;charset=utf-8"
$apires = Invoke-WebRequest -Uri $apiurl -Method $method -Headers $requestHeader -ContentType $contentType
#Display the responce body
$apires.Content
displayName: 'PowerShell Script'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.