Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
Azure app service is a platform as a service which is offered by Microsoft that is used to host web applications, REST API's and other backend services for mobile applications. It is not concerned with which programming language or framework has been used to develop the application. Any web application or service that has been developed using .NET, .NET Core, Java, Ruby, Node.js, PHP, or Python can be hosed using the azure app service.
As it is a Platform as a Service (PaaS) offering, which means that the organization that developed the application or service is only responsible for managing the application and its data. The rest of the things are managed by Azure. The organization does not need to worry about things such as managing the network or underlying infrastructure. It allows the organization to concentrate on what matters to the business.
Building Block of Azure App Service
App Service plan, also known as the App Service environment, is the most fundamental building block of Azure App Service. App Service has two types of hosting environments which are App service plan and App service environment.
App Service Environment
It is a more sophisticated version of the App Service plan and has a lot more features when compared to the App Service plan. It allows the user to host several Apps like web applications, web jobs, batches, APIs, and mobile backend services that can be consumed from our mobile's front-end. Apart from this, API management acts as a wrapper around the API apps when APIs are exposed to the outer world. It has many features such as throttling and security and is beneficial in case we want to commoditize our APIs and sell them to the outside world.
Apps within the App Service environment can seamlessly communicate with the other apps installed on the virtual machines within the virtual network.
App Service plan
It denotes a set of features and capabilities that can be shared across multiple apps within the same subscription and geographical region. It allows us to configure a single or dual app onto the same computing resources.
Each App Service plan defines the following fields:
Region
Number of VM instances
Size of VM instances
Pricing tier
Shared compute: Free and shared are the two basic types that run the app on the same Azure VM as the other App Service app runs, including the apps of different customers.
Dedicated compute: Basic, Standard, Premium, and PremiuimV2 tiers run apps on a fixed Azure VM.
Isolated: This runs dedicated Azure VMs on dedicated Azure VN, which provides the network isolation on top of computing isolation to your apps.
Consumption: it is used to scale the functions dynamically, depending on the workload. It is available for function apps only.
Benefits of using Azure App Service
Fully Managed Environment
In this, the App Service automatically patches and maintains the operating system and other language frameworks for the developers. It gives developers more time to focus on designing, developing, and maintaining the application and its data.
Multiple frameworks & languages are supported
It supports a wide variety of programming languages and frameworks which the developers can use. Programming languages like .NET, .NET Core, Java, Ruby, Node.js, PHP, and Python are supported by Azure App Service.
Scalability
It allows the developers to scale their resources up or down based on the demand of the application. It gives the developers a choice to manually adjust the resources or automatically based on the metrics such as CPU utilization.
Compliance
App Service is International Organization for Standardization (ISO), Service Organization Controls (SOC), and Payment Card Industry (PCI) compliant.
Security
It ensures the user's identity by allowing the user to authenticate using Azure Active Directory or any other authentication providers like Facebook, Google, or Microsoft.
Support for Containerization & Docker
It allows you to host a custom Windows or Linux container in App Service, using which you can either dockerize your apps or host them in the App Service. It can also be used to run multi-container apps with Docker Compose.
DevOps optimization
Allows the user to set up CI/CD, i.e., continuous integration and deployment with Azure DevOps, Github, etc.
Access on-premises data
With App Service, the user can access the data on their on-premise servers using either a Hybrid Connection or Azure Virtual Networks.
If you wish to install or update the plugin, you can visit the Jenkins update center (Manage Jenkins -> Manage Plugins, search Azure App Service Plugin)
In order to install the latest version of the plugin, which is not yet released, follow the steps below:
Clone the repo and build: mnv package
Open your Jenkins dashboard, then go to Manage Jenkins -> Manage Plugins
Go to the Advanced tab, under the Plugin section, and click on Choose file
Select azure-app-service.hpi in the target folder of the repo and then click upload
Restart your Jenkins Instance after installation is complete.
Deploy to Azure Web App
Prerequisites
In order to use this plugin to deploy to the Azure Web app, you need to have an Azure Service Principal in your Jenkins Instance.
Using the Azure CLI or Azure portal, create an Azure Service Principal
Add a new Microsoft Azure Service Principal with the credential information you created by going to the Credentials section in the Jenkins dashboard.
Deploy to Web App through File Upload
The user can deploy their project in .war or .zip file in Java to Azure Web App by simply uploading the build artifacts.
For Java EE apps, WAR deploy is used.
For Java SE apps, ZIP deploy is used.
For any other language, Git is used.
Steps:
Create a new freestyle project by adding all the necessary builds steps to build your code in Jenkins
Add a post-build action 'Publish an Azure Web App'.
Choose your Azure credentials from the Azure Profile Configuration section.
In the App Configuration section, choose a resource group of your choice and the web app in your subscription. Also, fill in the files that you want to deploy.
Source Directory and Target Directory are two optional parameters that allow the user to specify the source and target folders while uploading files.
It also allows you to set a Slot Name if you want to deploy a slot other than production.
After all the above steps are done, Save the project and build it. Once the build is complete, the web app will be deployed to Azure.
Deploy to Web App on Linus using Docker
In order to deploy using Docker, we need to provide a Dockerfile. It packages the web app along with the service runtime into a docker image. After that, the plugin builds the image, pushes it to a docker registry, and deploys the image to the web app.
To deploy using Docker, follow the steps:
Create a new freestyle project by adding all the necessary builds steps to build your code in Jenkins
Add a post-build action 'Publish an Azure Web App'.
Choose your Azure credentials from the Azure Profile Configuration section.
Fill in the Dockerfile path, Docker registry URL, and Registry credentials.
It allows you to specify the docker image name and tag in the Advanced tab. By default, the image name is the same as the image name user configured in the Azure portal, and the tag is generated from $BUILD_NUMBER.
Note: the deployment will fail if you use used built-in docker image setting. To ensure that, go to the Docker Container setting available in the Azure portal to change the docker configuration to be able to use a custom image. In case of a built-in image, use the file upload approach to deploy
Just like the file upload approach, we can also choose a different slot other than production.
Once it is saved and build, you will be able to see your container image is pushed to your registry, and the web app is deployed.
Frequently Asked Questions
Can we scale the resources used while using Azure App services?
Yes, we can scale the resources up or down while using Azure App services.
Which programming languages and technologies are supported by the Azure App Service?
Azure App services support .NET, .NET Core, Java, Ruby, Node.js, PHP, or Python can be hosed using the azure app service.
How does Azure enforce security?
Azure ensures the user's identity by allowing the user to authenticate using Azure Active Directory or any other authentication providers like Facebook, Google, or Microsoft.
Conclusion
In this article, we have extensively discussed the Azure App Services.
If you wish to enhance your skills in Data Structures and Algorithms, Competitive Programming, JavaScript, and many more, then you should check out our Guided path column at Coding Ninjas Studio. We at Coding Ninjas Studio organize many contests in which you can participate. You can also prepare for the contests and test your coding skills by giving the mock test series available. In case you have just started the learning process, and your dream is to crack major tech giants like Amazon, Microsoft, etc., then you should check out the most frequently asked problems and the interview experiences of your seniors that will surely help you in landing a job in your dream company.