Write and publish an HTTP function

Azure Portal, Hands On15 minutesFree tierSteps checked 25 October 2026By Cloud Hands On

In this task you'll create and deploy an HTTP-triggered function.

The quickest first function is an HTTP trigger: it runs whenever someone opens its web address. You write it on your own computer or in Cloud Shell with Azure Functions Core Tools (the func command), then publish it to the function app.

Each HTTP function has an authorisation level. Anonymous means anyone can call it; Function means callers must add a key from the portal.

Example. Larkfield Group's intranet calls a small HTTP function, holidays, that returns the office's bank holidays as JSON. It needed fifteen lines of code and no server.

Before you start

You need: Contributor on the function app. Time: 15 minutes.

Where to look

  1. Function App
  2. func-practice
  3. Functions

Steps

  1. Open Cloud Shell in Bash and make a project folder:Type mkdir hello-func && cd hello-func, then func init --worker-runtime node --language javascript
  2. Add an HTTP function called hello:Type func new --template "HTTP trigger" --name hello. Read the file it creates under src/functions: the template sets authLevel: 'anonymous', so anyone can call it without a key.
  3. Publish it to your function app:Type func azure functionapp publish <function app name>. It prints the function's address when it's done.
  4. Open the address, adding ?name=SS Kaiser at the end. You'll see Hello, SS Kaiser!If you change authLevel to 'function' and publish again, the plain address returns 401. Copy the address with Get function URL in the portal, which includes the key.
  5. In the portal, the app's Overview shows Flex Consumption as the plan type and hello in its Functions list. Select hello and look at Code + Test, Invocations and Function Keys.Invocations shows recent runs once Application Insights is turned on.

Commands

# Make a JavaScript project with one HTTP function
mkdir hello-func && cd hello-func
func init --worker-runtime node --language javascript
func new --template "HTTP trigger" --name hello

# Publish it to an existing function app
func azure functionapp publish <function app name>

# List the functions in the app
az functionapp function list --resource-group rg-portal-practice --name <function app name> --output table

Watch out for

Cost
A few test runs are well inside the free allowance.
Security
Use the Function authorisation level for anything that isn't meant to be public, and never put keys or passwords in the code: use app settings, Key Vault and managed identities.
Common mistakes
Running func commands outside the project folder. Publishing to the wrong app name. Forgetting the key for a Function-level HTTP trigger and getting a 401 error.

Clean up

  1. Resource groups
  2. rg-portal-practice
  3. Delete resource group

Remove the practice folder with cd ~ && rm -r hello-func. You've finished the functions section: delete the resource group to remove the function app and its storage account.

Words to know

Azure Functions Core Tools
The func command, for creating, running and publishing functions. It's already in Cloud Shell.
Authorisation level
Who can call an HTTP function: anonymous, or only callers with a function key.
Function key
A secret code added to the address (as ?code=...) to call a protected function.

Tick off each step and track your progress in the guide.

Open this task in Azure Portal, Hands On

Keep going