Last active
April 5, 2020 14:49
-
-
Save JustinGrote/d751dd1b05ef0db35921da01e375a5ab to your computer and use it in GitHub Desktop.
Powershell Azure Function Template Starter
This file contains 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
function New-AzFunction { | |
[CmdletBinding(SupportsShouldProcess)] | |
param( | |
[Parameter(Mandatory)][String]$Name, | |
[ValidateSet( | |
"Azure Blob Storage trigger", | |
"Azure Cosmos DB trigger", | |
"Azure Event Grid trigger", | |
"Azure Event Hub trigger", | |
"HTTP trigger", | |
"IoT Hub (Event Hub)", | |
"Azure Queue Storage trigger", | |
"SendGrid", | |
"Azure Service Bus Queue trigger", | |
"Azure Service Bus Topic trigger", | |
"SignalR negotiate HTTP trigger", | |
"Timer trigger" | |
)][String]$Template = 'HTTP Trigger', | |
[String]$Language = 'Powershell' | |
) | |
if ($PSCmdlet.ShouldProcess($pwd,"Creating $Language $Template function $Name")) { | |
$funcExe = (Get-Command func -Type 'Application' -ErrorAction stop).Source | |
& $funcExe new --language $Language --template $Template --name $Name | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The first error is a psreadline error, please install powershell preview extension for vscode.
The second error is because I assumed there would be only one "func" installed on your system
This command is for creating local functions for development. For deployment you may want to check out the Azure Functions Vscode extension.