How to create an App Service on Azure Cloud
App Service is used to quickly build, deploy and scale web apps. It is a fully managed platform with built-in infrastructure maintenance, security patching and scaling. It has built-in CI/CD integration and zero-downtime deployments. It is used to host web applications, REST APIs, and mobile back ends. App Service supports ASP.NET, ASP.NET Core, Java, Ruby, Node.js, PHP, or Python. It automatically patches and maintains the OS and language frameworks. It supports Continuous Deployment with Git, Team Foundation Server, GitHub and DevOps.
App Service plans are billed on a per-second basis. To know about its pricing, click here.
Before we create an App Service, let's understand a few terms.
- Runtime Stack: It defines the technology stack used to develop the app.
- Deployment center: The Deployment Center is a centralized place for all the deployment methods for configuring continuous integration/continuous deployment.
- App Service Plan: It defines a set of computing resources for a web app to run.
We can deploy an app using Azure CLI and Azure Portal.
In this article, we will create an App Service and deploy a sample Java Application in it using the Azure Portal. We will manually deploy the sample app on the FTP Server which will be provided by the App Service itself. The FTP/S endpoint for our app is already active, no configuration is necessary to enable FTP/S deployment.
Pre-requisites
- Azure Account (Create if you don’t have one).
- FTP Client.
What will we do?
- Login to Azure.
- Create a Web App Service.
Login to Azure
Click here to go Azure portal and click on Portal.
Use your credentials to log in to the account.
You will see the main page as follows once you successfully login to your account. Click on 3 lines near "Microsoft Azure" in the upper left-hand corner of the Azure portal to show the portal menu.
Create an App Service
Click on "All Services" in the left panel.
Under "Web", click on App Services.
You will see the main dashboard of App Services, here click on "Add".
Under Basics, create a Resource Group if you don't have it in your account. Give a name to the app service, this name must be globally unique and no 2 App Services across Azure can have the same name.
Here we will be uploading a sample Java Application so select Publish as Code and Runtime as Tomcat 8.5 under Java 8.
Select the region in which you want to create the App Service, here we have "Central US".
Click on "Next: Monitoring" to proceed.
Click on "Tags" with the default configuration here.
Add tags of your choice, here we have "environment: test".
Click on "Review + create".
Click on "Create" if you don't get any errors.
In a few minutes, the App Service will be ready.
Click in Resource Group "test-rg" to go to the Resource Group under which we have created the App Service.
Click on the App Service we have just created.
Here, you can find the details of the App Service.
Copy the URL and access it in the browser.
When you hit the URL, you will see the default webpage for the service we created.
To deploy a sample app click on "Deployment center", then click on FTP and then Dashboard.
You will see the credentials to log in to the FTP server where the sample app can be copied. Do not share these credentials with anyone.
If you do not have a sample app, you can down the one from here. This is a Java Application that will print "Hello World" on the browser. Download this file on your system before you upload it to the FTP Server.
Copy the sample app at "/site/wwwroot/webapps" in the FTP Server using the FTP Client. Here, FileZilla is used as an FTP Client.
Now hit the same URL of the app service and you can see that the sample app has been deployed successfully.
When you no longer need the App Service, you can delete it by deleting the resource group itself if it does not have other resources in it.
Conclusion
In this article, we saw the steps to create a Java App Service and deployed a sample application in it.
We saw how to deploy the sample app using FTP Server.