Deploy Azure Functions from the CLI
Intermediate12 min
Create a serverless function app and deploy functions using Azure CLI and Azure Functions Core Tools.
Prerequisites
- -Azure CLI installed
- -Azure Functions Core Tools installed
- -Active Azure subscription
Steps
1
Create a resource group and storage account
Functions require a storage account for triggers and state management.
$ az group create --name func-rg --location eastus && az storage account create --name funcstore$RANDOM --resource-group func-rg --sku Standard_LRS
2
Create the function app
Creates a consumption-plan function app that scales automatically and bills per execution.
$ az functionapp create --resource-group func-rg --consumption-plan-location eastus --runtime node --runtime-version 20 --functions-version 4 --name myfunc-unique --storage-account funcstore
Consumption plan is free for the first 1 million executions per month.
3
Initialize a local function project
Scaffolds a local project with the required configuration files.
$ func init MyFuncProject --worker-runtime node --language javascript
4
Create a function
Adds an HTTP-triggered function to the project.
$ cd MyFuncProject && func new --name HttpTrigger --template "HTTP trigger"
5
Deploy to Azure
Packages and deploys all functions in the project to the remote function app.
$ func azure functionapp publish myfunc-unique
Full Script
FAQ
Discussion
Loading comments...