Created
December 18, 2018 22:42
-
-
Save kkamegawa/694b0da6a904787e1958a1a695e2f3fe to your computer and use it in GitHub Desktop.
Azure Pipeline task to call Azure REST API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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