Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create a PowerShell 7 function app using Az.Functions
# Install the PowerShell 7. To do this, run the following:
iex "& { $(irm 'https://aka.ms/install-powershell.ps1')} -UseMSI"
# Open PowerShell 7 and install the latest version of Az which includes Az.Functions
# Link to Az.Functions docs -- https://docs.microsoft.com/en-us/powershell/module/az.functions/?view=azps-4.3.0#functions
Install-Module Az
# Sign in to Azure
Login-AzAccount
# Select the location where to host the function app, for this example, I will choose 'central us'
Get-AzFunctionAppAvailableLocation -PlanType Consumption -OSType Windows
# Create resource group and storage account
$rd = 'rg-central-us'
$location = 'centralus'
$storageAccountName = 'franciscotest1122'
$functionAppName = 'PowerShell-7-consumption-central-us'
# Create resource group name
New-AzResourceGroup -Name $rd -Location $location
# Create storage account
New-AzStorageAccount -ResourceGroupName $rd -AccountName $storageAccountName -Location $location -SkuName Standard_GRS
# Create a PowerShell 7 function app
New-AzFunctionApp -ResourceGroupName $rd `
-Name $functionAppName `
-StorageAccountName $storageAccountName `
-Location $location `
-OSType Windows `
-Runtime PowerShell `
-RuntimeVersion 7.0
# Get the newly created function app
Get-AzFunctionApp -ResourceGroupName $rd -Name $functionAppName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment