I have an automation account in Azure and I have a runbook in it. What I'm trying to do is to make an API call from this runbook. I'll need to login to some web service, get a session token and then use this session token to call some controller's methods.
So far I have only found some ways to call Azure runbooks through API (let's say from some backend c# code), but not vica versa. What I need to do is to call some c# methods FROM Azure runbook.
Is there a way to do it? If there is, how do I pass queries within my call? What I'm expecting to see is something like:
$response = MakeApiCall -Url "www.someurl.com" -Body "some json for example"
Yes you can.
It's either
$Url = "https://my-url"
$Body = @{
field = "value"
}
Invoke-RestMethod -Method POST -Uri $url -Body $body -UseBasicParsing
or
Invoke-WebRequest
Invoke-RestMethod by default parses output, Invoke-WebRequest donesn't.