Azure

    Zero Config Provider

    Integration with this provider is possible with zero configuration. (Learn More)

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

    You can invoke a development environment to preview before deploying.

    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.

    If you miss this step, you can always find the build configuration section in your workflow and update the build configuration:

    1. # .github/workflows/azure-static-web-apps-<RANDOM_NAME>.yml
    2. ###### Repository/Build Configurations ######
    3. app_location: '/'
    4. api_location: '.output/server'
    5. output_location: '.output/public'
    6. ###### End of Repository/Build Configurations ######

    Note: Pending an update in the , you will also need to run the following in your root directory:

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

    Azure Functions

    Preset: azure-functions

    Note: If you encounter any issues, please ensure you’re using a Node.js 14+ runtime. You can find more information about .

    You can invoke a development environment from the serverless directory.

    1. NITRO_PRESET=azure-functions yarn build
    2. cd .output
    3. 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:

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

    Then create the following file as a workflow:

    1. # .github/workflows/azure.yml
    2. name: azure
    3. on:
    4. push:
    5. - main
    6. pull_request:
    7. - main
    8. jobs:
    9. deploy:
    10. runs-on: ${{ matrix.os }}
    11. strategy:
    12. matrix:
    13. os: [ ubuntu-latest ]
    14. node: [ 14 ]
    15. steps:
    16. - uses: actions/setup-node@v2
    17. with:
    18. node-version: ${{ matrix.node }}
    19. - name: Checkout
    20. uses: actions/checkout@master
    21. - name: Get yarn cache directory path
    22. id: yarn-cache-dir-path
    23. run: echo "::set-output name=dir::$(yarn cache dir)"
    24. id: yarn-cache
    25. with:
    26. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
    27. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
    28. restore-keys: |
    29. ${{ runner.os }}-yarn-azure
    30. - name: Install Dependencies
    31. if: steps.cache.outputs.cache-hit != 'true'
    32. run: yarn
    33. - name: Build
    34. run: npm run build
    35. env:
    36. NITRO_PRESET: azure-functions
    37. - name: 'Deploy to Azure Functions'
    38. uses: Azure/functions-action@v1
    39. with:
    40. app-name: <your-app-name>

    Optimizing Azure Functions