Azure Static Web Apps introduces API backend options

Azure recently announced the preview of new API backend options in Azure Static Web Apps. Developers can now build an end-to-end authenticated application calling APIs hosted on Azure App Service, Azure Container Apps, or Azure API Management.

Static Web Apps (SWA) is an Azure service that automatically builds and deploys complete web applications directly from a code repository, with GitHub and AzureDevOps integration. A common requirement of web applications is to call backend APIs for data and services and the functionality of SWA APIs provides built-in security with direct access to user authentication and role-based authorization data. Annina Keller, software engineer at Microsoft, explains:

You can link any of these resources to the named production or preview environments of your static web application. When bound, all requests to a route prefixed with /api are routed to your backend resource. Using a linked backend allows your front-end application to call your API without setting up cross-origin resource sharing (CORS), and allows Static Web Apps Authentication to work seamlessly and securely with your API.

SWA was already integrated with Azure Functions, allowing developers to deploy an API with the static web application without managing a separate Azure Functions resource. The new options instead support a “bring your own API” scenario, integrating a static web application with existing APIs hosted on other Azure services.


App Service can be used to host APIs built with frameworks such as Flask, Express, Apollo, and ASP.NET, container apps to integrate with APIs and microservices running in serverless containers, and API management to aggregate multiple APIs into a unified API gateway. Martyn Coupland, DevOps Manager at Transparity, tweet:

This is really great news if you are using SWA or if you are using a single page application and want to integrate it with a backend.

In a separate learning series, Lee Stott, lead cloud advocate at Microsoft, explains how to deploy apps with SWA and why the service can be a first step for new developers. Stot writes:

SWA is now one of the best and easiest ways for students to build and deploy websites and with Azure for students and you do it for free.

The cloud provider has released best practices for SWA and a recording on how to use the SWA CLI. Among the current limitations of the new backend options, each static web application environment can only be configured with one type of backend API at a time, the API route prefix must be /api, WebSocket n is not supported (HTTP only) and the maximum duration of each request is 45 seconds.

The new option is only available in the SWA Standard plan. Built-in and managed Azure Functions APIs are available in all plans, including the free plan.

Comments are closed.