Creating PowerShell Azure Functions and deploying them with Bicep
Azure Functions supports various runtimes. One of them is PowerShell. Not all workloads of an Azure Function are complex. In that case, a PowerShell Azure Function might be useful to execute small tasks.
In this article, I’m creating an Azure Function based on PowerShell. I’m coding the required infrastructure with Bicep so that it can be deployed continuously too. As a result, with a couple of files, you can deploy the Azure Function and the changes we’ve made to it repeatedly, continuously.
Prerequisites
Azure Functions did not always support PowerShell. It was introduced in 2019. As a result, you need to make sure you’re using tooling that’s been introduced after 2019 to make sure you can use the Azure Functions PowerShell functionality locally.
To create and run PowerShell Azure Functions locally make sure to have installed the following tools:
- Install PowerShell Core version > 7.x.x (Mac/Windows). Make sure the correct version has been installed by executing the following command:
pwsh
$PSversionTable
- Install Azure-Function-Core-Tools version > 4.x.x. Make sure the correct version has been installed by executing the following command:
func --version