BETA

Skip links

  • Skip to primary navigation
  • Skip to content
  • Skip to footer
Queensland government logo Queensland government logo
Sign in Sign out
Sign in
  • Profile summary
  • Sign out
Department of Education Department of Education Developer Portal
  • Home
  • Tags
  • Chat
  • New
    APIs
  • Help
  • Contact us
  • Dark mode
  • Home
  • Tags
  • Chat
  • New
    APIs
  • Help
  • Contact us
  • My profile
  • Dark mode

Configuring local Azure Function APIs for Azure SWA

Matt Warwick Government Certified Admin
by Matt Warwick
24 May 2023
Last updated 21 May 2025
API Cloud Getting started
API Cloud Getting started

When running your SWA (statis web app) site in a local development environment, you may be incorporating APIs using Azure serverless functions under the covers, and getting these running locally can be a challenge. In a lot of cases authentication relies on local APIs to work as well.

Here is how to get up and running.

Install and configure SWA CLI

To run your frontend app and API together locally, Azure Static Web Apps provides a CLI that emulates the cloud environment. The CLI uses the Azure Functions Core Tools to run the API.

Install command line tools

npm install -g @azure/static-web-apps-cli

Start the API server

Open a new Node console, browse to your projects API folder and run the following:

func host start --csharp

Start the CLI

Then in your VS Code terminal window, browse to the root of your project and run the following:

swa start http://localhost:4000 --run "jekyll serve" --api-location ./api --api-devserver-url http://localhost:7071

Allow the local servers to fire up and then browse to http://localhost:7071 to test your SWA!

Authenticate locally using SWA Auth

If you have configured authentication using Azure B2C then clicking on your “Sign in” button or link will take you to a local sign in test page:

Image of Azure B2C test authentication page

Here you can edit some default values including:

  • User ID
  • Username
  • User’s roles
  • User’s claims

Click “Login” and happy testing!

Powered by Link to AI chat
  • Copyright
  • Disclaimer
  • Privacy
  • Right to information
  • Accessibility
  • Jobs in Queensland Government
  • Other languages

© The State of Queensland (Department of Education) 2025

Queensland Government