How to create a static web app in Azure

Azure Static Web Apps is a service that automatically builds and deploys full stack web applications to Azure from a code repository (either Github or Azure Devops).

Prerequisites

Have an Azure Account. If you do not have one, you can cre…


This content originally appeared on DEV Community and was authored by Moyinoluwa Adenuga

Azure Static Web Apps is a service that automatically builds and deploys full stack web applications to Azure from a code repository (either Github or Azure Devops).

Prerequisites

  • Have an Azure Account. If you do not have one, you can create an account here.
  • A Github or Azure Devops Account to host your code. (This article would describe the Github workflow)

Step 1: Create the code repository

To host the application code, you need to have a repository either on Github or Azure Devops. In this article, I used Github and created a repository using this template.

Generating Code Repository From Template on Github

Step 2: Create a static web app (Using Github)

  1. From the azure portal, search for Static Web Apps and select the Static Web Apps service in the dropdown. Search for Static Web Apps in Azure
  2. Select Create or Create static web app button has shown below. Create static web app in Azure
  3. On the basic tab, fill in the required fields
  • Subscription: Select your Azure subscription
  • Resource Group: Select a resource group if you have one created or use the Create new link, and enter a resource group name.
  • Name: This is the name of the application. I used moyin-static-web-app. Enter your desired name in the textbox.
  • Plan type: Select Free.
  • Azure Functions and staging details: Select a region closest to you.I left it as default.
  • Source: Select GitHub and authenticate by clicking Sign in with Github button. Creating static web app in Azure
  • Once authenticated, select the code Organization, Repository and Branch from the dropdowns.
  • Build Presets: Select the framework or language used to write the code. I used React.
  • App location: Put the path of your application. Mine is the root folder so I left it as default('/).
  • Api location: If you are working with an api, you can add the path here.
  • Output location: Enter the path of your build.

Once done, review and create the application
Code configurations for static web app
Create static web app in azure

When deployment is complete, select the Go to resource button
Deployment complete in creating static web app in azure

Step 3: Viewing the web application

The deployment build must be completed before the site can be viewed.You can select the banner with Click here to check the status of your github action runs.
Deployment build of azure static web app in progress

Once the build (Github Actions workflow) is completed, select the url and view the deployed web application as shown below.
Select static web app url
Deployed Azure Static Web Apps

Step 4: Cleaning up resources

If you are not going to be using the application, then delete the Azure Static Web Apps instance to avoid incurring unnecessary costs.
Deleting the azure static wep app instance


This content originally appeared on DEV Community and was authored by Moyinoluwa Adenuga


Print Share Comment Cite Upload Translate Updates
APA

Moyinoluwa Adenuga | Sciencx (2023-04-15T15:07:47+00:00) How to create a static web app in Azure. Retrieved from https://www.scien.cx/2023/04/15/how-to-create-a-static-web-app-in-azure/

MLA
" » How to create a static web app in Azure." Moyinoluwa Adenuga | Sciencx - Saturday April 15, 2023, https://www.scien.cx/2023/04/15/how-to-create-a-static-web-app-in-azure/
HARVARD
Moyinoluwa Adenuga | Sciencx Saturday April 15, 2023 » How to create a static web app in Azure., viewed ,<https://www.scien.cx/2023/04/15/how-to-create-a-static-web-app-in-azure/>
VANCOUVER
Moyinoluwa Adenuga | Sciencx - » How to create a static web app in Azure. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/04/15/how-to-create-a-static-web-app-in-azure/
CHICAGO
" » How to create a static web app in Azure." Moyinoluwa Adenuga | Sciencx - Accessed . https://www.scien.cx/2023/04/15/how-to-create-a-static-web-app-in-azure/
IEEE
" » How to create a static web app in Azure." Moyinoluwa Adenuga | Sciencx [Online]. Available: https://www.scien.cx/2023/04/15/how-to-create-a-static-web-app-in-azure/. [Accessed: ]
rf:citation
» How to create a static web app in Azure | Moyinoluwa Adenuga | Sciencx | https://www.scien.cx/2023/04/15/how-to-create-a-static-web-app-in-azure/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.