Quickstart: Building your first static site in the Azure portal
Azure Static Web Apps publishes a website to a production environment by building apps from a GitHub repository. In this quickstart, you deploy a web application to Azure Static Web apps using the Azure portal.
If you don't have an Azure subscription, create a free trial account.
Create a repository
This article uses a GitHub template repository to make it easy for you to get started. The template features a starter app used to deploy using Azure Static Web Apps.
- Navigate to the following location to create a new repository:
- Name your repository my-first-static-web-app
Azure Static Web Apps requires at least one HTML file to create a web app. The repository you create in this step includes a single index.html file.
Select Create repository from template.
Create a static web app
Now that the repository is created, you can create a static web app from the Azure portal.
- Navigate to the Azure portal.
- Select Create a Resource.
- Search for Static Web Apps.
- Select Static Web Apps.
- Select Create.
In the Basics section, begin by configuring your new app and linking it to a GitHub repository.
- Select your Azure subscription.
- Next to Resource Group, select the Create new link.
- Enter static-web-apps-test in the textbox.
- Under to Static Web App details, enter my-first-static-web-app in the textbox.
- Under Azure Functions and staging details, select a region closest to you.
- Under Deployment details, select GitHub.
- Select the Sign-in with GitHub button and authenticate with GitHub.
After you sign in with GitHub, enter the repository information.
Select your preferred Organization name.
Select my-first-web-static-app from the Repository drop-down.
Select main from the Branch drop-down.
If you don't see any repositories, you may need to authorize Azure Static Web Apps in GitHub. Browse to your GitHub repository and go to Settings > Applications > Authorized OAuth Apps, select Azure Static Web Apps, and then select Grant. For organization repositories, you must be an owner of the organization to grant the permissions.
In the Build Details section, add configuration details specific to your preferred front-end framework.
Select Review + create.
You can edit the workflow file to change these values after you create the app.
Select Go to resource.
View the website
There are two aspects to deploying a static app. The first provisions the underlying Azure resources that make up your app. The second is a GitHub Actions workflow that builds and publishes your application.
Before you can navigate to your new static site, the deployment build must first finish running.
The Static Web Apps overview window displays a series of links that help you interact with your web app.
Clicking on the banner that says, Click here to check the status of your GitHub Actions runs takes you to the GitHub Actions running against your repository. Once you verify the deployment job is complete, then you can navigate to your website via the generated URL.
Once GitHub Actions workflow is complete, you can click on the URL link to open the website in new tab.
Clean up resources
If you're not going to continue to use this application, you can delete the Azure Static Web Apps instance through the following steps:
- Open the Azure portal.
- Search for my-first-web-static-app from the top search bar.
- Select the app name.
- Select the Delete button.
- Select Yes to confirm the delete action (this action may take a few moments to complete).