Easiest way to deploy your website using Microsoft Azure App Services
Hosting the website and controlling it in real time can be overwhelming to new developers. In this blog, you’ll learn how to deploy your website using Azure.
Hosting a website on Azure, Microsoft’s cloud computing platform, can provide a number of benefits for businesses and individuals looking to create an online presence. Azure offers a range of website hosting options, including shared hosting, virtual machine hosting, and container hosting, each with its own set of features and pricing plans. In this blog, we’ll explore the benefits of hosting a website on Azure and provide a step-by-step guide on how to host website using Azure App Services.
Whether you’re a first timer or experienced developer, this blog will give you all the information you need to host a website on Azure with confidence.
Benefits of Hosting Your Website on Cloud:
There are several benefits to hosting a website on the cloud than the traditional hosting providers
- Security:
Cloud hosting providers have advanced security measures in place to protect your website and data. - Cost:
Cloud hosting can be more cost-effective than traditional hosting, as you only pay for the resources you use. This can be especially useful for small businesses or websites with fluctuating traffic patterns. - Scalability:
Cloud hosting allows you to scale your website’s resources up or down as needed, so you only pay for what you use. This is particularly useful if your website experiences sudden spikes in traffic. - Reliability:
Cloud hosting is often more reliable than traditional hosting, as it uses multiple servers to host your website, rather than just one. This means that if one server goes down, your website can still be accessed from another server. - Performance:
Cloud hosting can offer faster performance, as the resources of multiple servers are pooled together to serve your website.
What is Azure App Service?
Azure App Service is a fully managed platform-as-a-service (PaaS) that enables you to build, deploy, and scale web, mobile, and API applications. It provides a variety of features and tools such as Visual Studio, Visual Studio Code, or Eclipse to help you quickly and easily develop, host, and manage your applications in the cloud.
We may use Azure App Service to create and host web apps, mobile back ends, and RESTful APIs, in any programming language. It supports both Windows and Linux and allows automatic deployments from GitHub, Azure DevOps, or any Git repository. This enables your application’s Continuous Integration and Continuous Deployment (CI/CD) to run smoothly. You can make changes to your source code and see them immediately reflected in the deployed app.
Let's get started
Prerequisites: An active Azure subscription.
You may use the Azure for Students to get a subscription for free or else you can use Azure free account.
- Create a FREE Microsoft Azure account:
Go to https://azure.microsoft.com/ and click on “Free Account” to sign up for a new Azure account. You will need to provide a valid email address, create a password, and enter your billing information.
If you are a student, use the Azure for Students to get a free subscription and get 100 $ azure credits. - Set up a resource group:
A resource group is a logical container that holds all the resources you create for your application. To create a resource group, go to the Azure portal and click on “Create a resource” in the top left corner. Select “Resource group” from the list of resource types and follow the prompts to create a new resource group.
3. Create a web app:
To create a web app, go to the Azure portal and click on “Create a resource” in the top left corner.
a. Search or select “Web App” from the list of resource types and follow the prompts to create a new web app.
b. Choose one of the default resource group or create a new one.
c. You will need to provide a name for your web app and choose an appropriate runtime stack. With Azure App Service, you can deploy your applications using a variety of languages, including .NET, .NET Core, Java, Ruby, Node.js, PHP, and Python. Here, I have chosen NodeJS, you can choose any based-on stack used to develop the site.
d. Choose Region and Pricing Plan and click ‘Next’.
d. Click ‘Review+create’ once done.
4. Deploy your web application:
There are several ways to deploy your web application to Azure, including using FTP, Git, or Visual Studio. One of the easiest ways is to use the Azure portal to deploy your application from a Git repository.
To do this, go to the Azure portal and navigate to your web app. Click on the “Deployment options” blade and choose “GitHub” as your source control provider. Follow the prompts to link your Azure web app to your GitHub repository and choose the branch you want to deploy.
5. Test your web application:
Once your web application has been deployed, go to resource page, copy the URL and paste it in your browser window.
The URL will be in the format “https://your-web-appname.azurewebsites.net". If your web application is working correctly, you should see the homepage of your web app when you navigate to this URL.
Here, for example, my website was deployed at https://blazeee.azurewebsites.net
Refer the source code here: https://github.com/boradesanket13/Blaze
Woho! We have successfully deployed a web app using Azure.🚀
Further Learning
Azure App Service: https://docs.microsoft.com/en-us/azure/app-service/
Thats all for now. I hope you enjoyed reading this blog. Feel free to hit me on Twitter! See you in the next one. Ciao😇