This project started as a side project to start working on OOP with a PowerShell module. I needed a subject and at this time I worked with Azure Function.
One of my main problems when working with Azure Functions v2 with PowerShell is to deal with Binding and Trigger. How to remember what binding I can use, which direction, which extension. It’s easy when using the portal, but if you need to create and modify function locally it’s not the best way. This is only a Proof of Concept for the moment. There is a lot of work to do. The goal is to publish the module in the PowerShell Gallery.
This module is listed on powershellgallery
Install-Module -Name PoshServerLess -Scope CurrentUser
You can check the full documentation here
You can find the release notes here
There are 4 main objects used in this module
- PoshServerLessApp, the representation of one Azure Functions App V2 for PowerShell
- PoshServerLessFunction, the representation of one Function in a an Azure function App
- PoshServerLessFunctionTrigger, the representation of the trigger of a function in an Azure function App
- PoshServerLessFunctionBinding, the representation of binding of a function in an Azure function App
$FunctionApp = sync-PoshServerlessFunctionApp -FunctionAppName "FunctionName" -ResourceGroupName "RGName" -LocalFunctionPath "C:\work\lab\functions\FunctionName"
$Function = new-PoshServerLessFunction -FunctionAppPath "C:\work\lab\functions\FunctionName" -FunctionName "TimerFunction"
$Trigger = new-PoshServerLessFunctionTrigger -TriggerType timerTrigger -Schedule "0 */5 * * * *"
update-PoshServerLessFunctionTrigger -triggerObject $Trigger -FunctionObject $Function
$Queue = new-PoshServerLessFunctionBinding -Direction out -BindingName MyQueue – connection AzureWebStorage -queueName myAzureQueue
add-PoshServerLessFunctionBinding -FunctionObject $Function -BindingObject $Queue
$Function | write-PoshServerlessFunction
add-PoshServerLessFunctionToApp -FunctionAppObject $FunctionApp -FunctionObject $function
publish-PoshServerLessFunctionApp -FunctionAppObject $FunctionApp