Skip to content

Instantly share code, notes, and snippets.

@JohnRoos
Created January 20, 2021 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnRoos/546e90c875d982998c60f58f60843a72 to your computer and use it in GitHub Desktop.
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 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