How to deploy Nuxt to Azure Static Web Apps or Azure Functions.

Azure Static Web Apps

How to deploy Nuxt to Azure Static Web Apps with Nuxt Nitro.

Support for serverless SSR build
Auto-detected when deploying
Minimal configuration required


Azure Static Web Apps are designed to be deployed continuously in a GitHub Actions workflow . By default, Nitro will detect this deployment environment and enable the azure preset.

Local preview

You can invoke a development environment to preview before deploying.

NITRO_PRESET=azure yarn build
npx @azure/static-web-apps-cli start .output/public --api-location .output/server

Deploy from CI/CD via GitHub Actions

When you link your GitHub repository to Azure Static Web Apps, a workflow file is added to the repository.

Find the build configuration section in this workflow and update the build configuration:

###### Repository/Build Configurations ######
app_location: '/'
api_location: '.output/server'
output_location: '.output/public'
###### End of Repository/Build Configurations ######


Pending an update in the Azure Static Web Apps workflow , you will also need to run the following in your root directory:

mkdir -p .output/server
touch .output/server/.gitkeep
git add -f .output/server/.gitkeep

That's it! Now Azure Static Web Apps will automatically deploy your Nitro-powered Nuxt application on push.

Azure Functions

Support for serverless SSR build
No configuration required
Static assets served from Azure Function


export default {
  nitro: {
    preset: 'azure_functions'

Local preview

Install Azure Functions Core Tools if you want to test locally.

You can invoke a development environment from the serverless directory.

NITRO_PRESET=azure_functions yarn build
cd .output
func start

You can now visit http://localhost:7071/ in your browser and browse your site running locally on Azure Functions.

Deploy from your local machine

To deploy, just run the following command:

# To publish the bundled zip file
az functionapp deployment source config-zip -g <resource-group> -n <app-name> --src dist/
# Alternatively you can publish from source
cd dist && func azure functionapp publish --javascript <app-name>

Deploy from CI/CD via GitHub Actions

First, obtain your Azure Functions Publish Profile and add it as a secret to your GitHub repository settings following these instructions .

Then create the following file as a workflow:

name: azure
      - main
      - main
    runs-on: ${{ matrix.os }}
        os: [ ubuntu-latest ]
        node: [ 12 ]
      - uses: actions/setup-[email protected]
          node-version: ${{ matrix.node }}

      - name: Checkout
        uses: actions/[email protected]

      - name: Get yarn cache directory path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)"

      - uses: actions/[email protected]
        id: yarn-cache
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-azure

      - name: Install Dependencies
        if: steps.cache.outputs.cache-hit != 'true'
        run: yarn

      - name: Build
        run: npm run build
          NITRO_PRESET: azure

      - name: 'Deploy to Azure Functions'
        uses: Azure/functions-[email protected]
          app-name: <your-app-name>
          package: .output/
          publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}

Optimizing Azure Functions

Consider turning on immutable packages to support running your app from the zipfile. This can speed up cold starts.


A live demo is available on

Edit this page on GitHub Updated at Fri, Oct 15, 2021