How to create a static HTML website using Azure App Service?
Hello Everyone
Welcome to CloudAffaire and this is Debjeet.
In today’s blog post, we will discuss how to create a static HTML website using Azure App Service. Azure App Service enables you to build and host web apps, mobile back ends, and RESTful APIs in the programming language of your choice without managing infrastructure. It offers auto-scaling and high availability, supports both Windows and Linux, and enables automated deployments from GitHub, Azure DevOps, or any Git repo.
How to create a static HTML website using Azure App Service?
Prerequisites:
Azure CLI installed and configured
Step 1: Clone a static website template using git.
1 2 3 4 5 |
## Clone the static website template git clone https://github.com/CloudAffaire/static_page.git ## Get inside the static website repository cd static_page |
Step 2: Create a new resources group for your Azure app service.
1 2 3 4 |
## Create a new Azure resource group az group create \ --name AppServiceDemoRG \ --location westindia |
Step 3: Deploy a static website using the Azure app service.
1 2 3 4 5 6 7 |
## Deploy your static website using Azure web service az webapp up \ --location westindia \ --name AppServiceDemoStaticWeb \ --html \ --resource-group AppServiceDemoRG \ --sku B1 |
The above command will do the following things
- Create a default app service plan.
- Create an app with the specified name.
- Zip deploy files from the current working directory to the web app.
It may take 2-3 mins to create all the resources and deploy your static website using Azure App Service. Once the deployment is completed, you will get the endpoint URL to access your static website.
Step 4: Validate your webpage by opening the URL provided in the last step in your browser.
You can also check in Azure Portal
Note: if you want to deploy a new version of your static webpage, simply rerun the command provided in step 3 and Azure will automatically repackage your web pages and deploy the new version in the Azure App service.
Step 5: Clean up.
1 2 3 4 |
## Delete the resource group az group delete \ --name AppServiceDemoRG \ --yes |
Hope you have enjoyed this article. To get more details on Azure App Service, please refer to the below documentation.
https://docs.microsoft.com/en-us/azure/app-service/
Azure App Service CLI reference
https://docs.microsoft.com/en-us/cli/azure/webapp?view=azure-cli-latest