Created
January 20, 2021 10:58
-
-
Save JohnRoos/546e90c875d982998c60f58f60843a72 to your computer and use it in GitHub Desktop.
Function to trigger the start of a function inside an Azure Function App
This file contains hidden or 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
# This function triggers the start of a function inside an Azure Function App | |
function Start-FunctionAppFunction { | |
[CmdletBinding()] | |
param ( | |
# Enter the base url for the function app. Example: https://myappname.azurewebsites.net | |
[Parameter(Mandatory)] | |
[Uri]$FunctionAppBaseUrl, | |
# Enter the app key called _master | |
[Parameter(Mandatory)] | |
[string]$FunctionAppMasterKey, | |
# Enter the name of the function you want to start | |
[Parameter(Mandatory)] | |
[string]$FunctionName | |
) | |
Process { | |
$Url = "$FunctionAppBaseUrl/admin/functions/$FunctionName" | |
$Headers = @{ | |
'x-functions-key' = $FunctionAppMasterKey | |
} | |
Invoke-RestMethod -Uri $Url -Method Post -ContentType 'application/json' -Headers $Headers -Body '{"input":""}' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment