Hi, I am having difficulties getting the Webhook action to work with an Azure (Powershell) function. More specifically, I don't know how to respond back to the Power Automate flow. I am trying to get the sample script to work with the added last line to respond to Power Automate. Is this (Invoke-RestMethod) the right way to do it?
using namespace System.Net
# Input bindings are passed in via param block.
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# Interact with query parameters or the body of the request.
$targetSite = $Request.Query.TargetSite
$callbackUrl = $Request.Query.callbackURL
# Write out the queue message and insertion time to the information log.
Write-Host "Received provisioning request for site: $targetSite"
Write-Host "Received callback url: $callbackUrl"
$status = [HttpStatusCode]::OK
#$body = "Provisioning to $targetSite succeeded"
$Result = Invoke-RestMethod -Uri $callbackUrl -Method Post -body $status
The above code is failing with the following error message:
The request must be authenticated only by Shared Access scheme
This is what the Power Automate flow looks like so far, just for testing purposes:
I am not a developer. I'm an IT professional proficient with the Power Platform but not in writing functions. Any help with this would be greatly appreciated.