Skip to content

Latest commit

 

History

History
83 lines (51 loc) · 2.81 KB

README.md

File metadata and controls

83 lines (51 loc) · 2.81 KB

PoshServerLess

Build status

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.

Installation

This module is listed on powershellgallery

Install-Module -Name PoshServerLess -Scope CurrentUser

Documentation

You can check the full documentation here

Release notes

You can find the release notes here

Usage

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

Load an existing Azure Functions localy

$FunctionApp = sync-PoshServerlessFunctionApp -FunctionAppName "FunctionName" -ResourceGroupName "RGName" -LocalFunctionPath "C:\work\lab\functions\FunctionName"

Create a new Function

$Function = new-PoshServerLessFunction -FunctionAppPath "C:\work\lab\functions\FunctionName" -FunctionName "TimerFunction"

Add a Trigger to the function

$Trigger = new-PoshServerLessFunctionTrigger -TriggerType timerTrigger -Schedule "0 */5 * * * *"
 
 update-PoshServerLessFunctionTrigger -triggerObject $Trigger  -FunctionObject $Function

Add Binding

$Queue = new-PoshServerLessFunctionBinding -Direction out -BindingName MyQueue – connection AzureWebStorage -queueName myAzureQueue
 
add-PoshServerLessFunctionBinding  -FunctionObject $Function -BindingObject $Queue

write function

  $Function  | write-PoshServerlessFunction 

Update The Function App

add-PoshServerLessFunctionToApp -FunctionAppObject $FunctionApp -FunctionObject $function

Publish the function app

publish-PoshServerLessFunctionApp -FunctionAppObject $FunctionApp