Skip to content

02 - First Deploy (Consumption)

Provision a Consumption (Y1) function app and deploy the PowerShell project you built in step 01.

Prerequisites

Steps

Step 1 - Set variables

RG=rg-functions-demo
APP_NAME=func-ps-demo
STORAGE_NAME=stpsdemo$RANDOM
LOCATION=koreacentral

Step 2 - Create the resource group and storage

az group create --name $RG --location $LOCATION

az storage account create \
  --name $STORAGE_NAME \
  --resource-group $RG \
  --location $LOCATION \
  --sku Standard_LRS
| Command/Parameter | Purpose | | --- | --- | | az group create | Create the resource group that holds the tutorial resources. | | --name | Name of the resource group. | | --location | Azure region for the resource group. | | az storage account create | Create the storage account the function app requires. | | --name | Name of the storage account. | | --resource-group | Resource group that contains the storage account. | | --location | Azure region for the storage account. | | --sku | Storage replication SKU (Standard_LRS = locally redundant). |

Step 3 - Create the function app

az functionapp create \
  --name $APP_NAME \
  --resource-group $RG \
  --storage-account $STORAGE_NAME \
  --consumption-plan-location $LOCATION \
  --runtime powershell \
  --runtime-version 7.4 \
  --functions-version 4 \
  --os-type Windows
| Command/Parameter | Purpose | | --- | --- | | az functionapp create | Create the function app on a Consumption plan. | | --name | Name of the function app. | | --resource-group | Resource group that contains the function app. | | --storage-account | Storage account backing the function app. | | --consumption-plan-location | Region for the auto-created Consumption plan. | | --runtime | Language runtime stack (powershell). | | --runtime-version | PowerShell runtime version. | | --functions-version | Azure Functions runtime major version. | | --os-type | Operating system for the app (Windows). |

Step 4 - Deploy the code

func azure functionapp publish $APP_NAME

Verification

curl "https://$APP_NAME.azurewebsites.net/api/HttpExample?name=Azure"

Returns Hello, Azure.

Next Steps

Your app is live. Next, manage its configuration and secrets.

Next: 03 - Configuration

See Also

Sources

Legacy hosting path

Consumption plan (Y1) content is provided for existing workloads. For most new serverless applications, prefer Flex Consumption.