Skip to content

Instantly share code, notes, and snippets.

@Francisco-Gamino
Last active July 25, 2022 12:45
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Francisco-Gamino/7b22c6b55d6e21694502d633e43debb6 to your computer and use it in GitHub Desktop.
Save Francisco-Gamino/7b22c6b55d6e21694502d633e43debb6 to your computer and use it in GitHub Desktop.
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