What is Azure web app?

What is Azure Web App?

In this azure tutorial, we will discuss What is Azure web app?. Apart from this, we will also discuss on the below topics

  • Azure Web App Tutorial
  • Benefits Of Azure Web App
  • Azure web App architecture
  • Difference between Azure web app and Azure app service (Azure web app vs App service)
  • Azure web app authentication and authorization
  • Enable the web app authentication and authorization for the back end application
  • Enable the web app authentication and authorization for the front end application
  • Grant permission to the front end to access to the back end
  • App Service Configuration to return a user access token
  • Call API from the server code
  • Azure Web App Example
  • What Is Azure App Service
  • Key Features Of Azure App Service

What is Azure web app?

Azure Web App provides a hosting service in Azure which developers can use to develop different kinds of mobile applications or web applications. 

Azure Web App Tutorial

Azure Web App provides a platform to build different kinds of mobile applications or web applications. No need to deploy, configure, and maintain your own Azure virtual machine. 

Benefits Of Azure Web App

There are various benefits of using Azure Web App

  • Supports multiple languages like Java, .Net, PHP, etc
  • It supports continuous deployment and integration
  • High availability and scalability support.
  • Supports other platform integration. It can easily integrate with other platforms.
  • No need to take the headache for the maintenance of the infrastructure.
  • It supports different operating systems like Windows, Linux, etc.

In terms of deploying the Web Apps

  • It supports deployments of web apps by using the visual studio, WebMatrix, etc.
  • It supports copying different files manually by using FTP
  • Easy Synchronization files and folders to OneDrive or Dropbox

These are the details on What is Azure web app? and the key benefits of using Azure Web App.

Azure web App architecture

The below architecture shows how various Azure services fit together.

Azure web App architecture
Azure web App architecture

Resource group: This acts like a logical container that contains all the Azure resources.

App Service plan: This provides the managed virtual machines that host your applications.

Azure App Service: This is the platform for creating and deploying your mobile or web applications.

Azure DNS: This is a hosting service for the Domain. You can create and maintain your domains.

Storage bolb: Azure storage account with a blob container which is used to store the diagnostic logs.

Azure Active Directory: For authentication purpose.

Difference between Azure web app and Azure app service Web App (Azure web app vs App service)

  • The web app is a part of the most popular Azure app service.
  • This is is a fully managed service that helps to develop and deploy business-standard web applications
  • You can create a website in a span of seconds with the help of this.
  • This platform supports  .NET, Java, PHP, Python frameworks, etc

Some of the important features are

  • Can easily integrate with TFS, GitHub, etc
  • Supports continuous integration and deployment
  • It can develop a highly secure and standard web application.

Azure app service

Azure app service is a fully managed Platform as a Service that provides all the services needed to create different web apps, mobile apps, API Apps etc.

This platform integrates Microsoft Azure Websites, Mobile Services, and BizTalk Services into one.

The key features of Azure app services are

  • You can build operating system independent applications
  • Create and host web apps and mobile apps in a span of seconds.
  • Can easily build tools to automate the business processes
  • Can easily integrate with Office 365, Salesforce, Dropbox, etc
  • Supports multiple languages like Java, .Net, PHP, etc

Azure web app authentication and authorization

This service has built in support for authentication and authorization.

Enable the web app authentication and authorization for the back end application

To configure the authentication for the back end apps, you can use the below steps

  • Login to the Azure portal (https://portal.azure.com/)
  • Search for the Resource groups
Azure web app authentication and authorization
  • Click on the search result Resource groups and select your resource group from the list.
how to enable Azure web app authentication and authorization
  • Now from your resource group page, click on the Overview tab. select your back end application from the list.
how to create Azure web app authentication and authorization
  • In your app’s page left menu, select Authentication / Authorization.
  • Select the App Service Authentication as On.
  • Select Log in with Azure Active Directory for Action to take when request is not authenticated option.
  • Under Authentication Providers, you need to select Azure Active Directory.
Enable Azure web app authentication
  • Click on the Azure Active Directory. From the Azure Active Directory Settings page, Select Express for the Management mode.
  • Keep the other options as it is and then select the Ok button.
Azure web app authentication
  • Or you can Select Existing AD App for the Management mode options.
  • Select your Azure AD App by clicking that option. Now click on the OK button and now click on the Save button. You will see a notification on Successfully saved.
Configure Azure web app authentication
What is Azure web app authentication
  • Now you can able to see the Azure app you have created.click on Azure AD App.
How to configure authentication in Azure web app
  • Copy the client ID to your notepad. and click on the Ok button.
Why Azure web app authentication

Enable the web app authentication and authorization for the front end application

Above, we have discussed already, how to enable the web app authentication and authorization for the back end application

To enable the web app authentication and authorization for the front end application, Follow the steps as above but skip the last step that is to copy the client ID. No need to do this step.

Enable the web app authentication and authorization for the front end application

The back-end app now requires Azure Active Directory sign-in from the front-end app. To do this you need to configure below three things

  • Grant permission to the front end access to the back end
  • Configure App Service to return a usable token
  • Use the token generated above in your code

Grant permission to the front end to access to the back end

To grant the permission to the front end access to the back end, we need to do the following configurations.

  • Log in to the Azure portal (https://portal.azure.com/)
  • Search for the Azure Active Directory
Grant permission to the front end access to the back end in Azure
  • Click on the App registrations link. Now you click on the Front end app name under All applications.
how to grant permission to the front end to access to the back end
  • Now from the front end application page, Click on the API permissions link.
how to create permission for the front end to access to the back end
  • Click on the Add permission button under Configured permissions section.
how to configure enable the web app authentication and authorization for the front end application
  • From the Request API permissions page, search for your back end app under APIs my organization uses tab.
  • Click on the back end app.
configure the web app authentication and authorization for the web application
  • Select the Delegated permissions button under What type of permission does your application require?
  • Tick(select) the user_impersonation option under Permission option.
  • Now click on the Add permissions button.
configure the web app authentication and authorization in azure app service
  • Now you can see user_impersonation permission has been added successfully.
how to Grant permission to the front end to access to the back end in Azure

App Service Configuration to return a user access token

In this step, we will configure the App Service authentication and authorization to give you a user access token for accessing the back end application.

  • Now search for the App services. Click on the front end web application and then click on the Resource explorer link from the left menu under Development Tools.
App Service Configuration to return a usable access token
  • Click on the Go button from the Resource Explorer window. Now Azure Resource Explorer is opened with your front-end app selected in the resource tree
  • Select the Read/Write option at the top.
App Service Configuration to return a usable access token
  • In the left browser, go to config > authsettings.
  • In the authsettings view, click Edit and set the below value for “additionalLoginParams”. Here the client id is the id of the back end app which you have copied earlier.
"additionalLoginParams": ["response_type=code id_token","resource=<Client id of your back end application>"],
how to do App Service Configuration to return a user access token
  • Now you click on the Put button to save the changes.

Call API from the server code

Here in this step what we will do is we will enable our code to make authenticated calls to the back-end API

In your class file in front end application, in the constructor, You mention like the below code

public override void OnActionExecuting(ActionExecutingContext myappcontext)
{
    base.OnActionExecuting(myappcontext);

    _client.DefaultRequestHeaders.Accept.Clear();
    _client.DefaultRequestHeaders.Authorization =
        new AuthenticationHeaderValue("Bearer", Request.Headers["X-MS-TOKEN-AAD-ACCESS-TOKEN"]);
}

Save all your changes. In the local terminal window, deploy your changes to the front-end app. You can use the below git commands to deploy

git add .
git commit -m "Authorization Header"
git push frontend master

Azure web app service plan

An App Service plan is nothing but a set of computing resources for a web app to run. When an app is running on the app service behind the scene, the app is attached to an app service plan.

When you are creating any Azure web app service plan you need to select a region for that. So as per the Azure web app service plan, the number of computing resources is getting created in that particular region.

An Azure web app service plan is based on the below factors

  1. Region
  2. Number of VM instances
  3. Size of the VMs
  4. Pricing tier

Regions are like East India, West India, Central India, East US, West US etc.

Number of VM instances includes how many VM instances you want to use for the Azure web App operations.

Size of the VMs includes what are the sizes of the virtual machines(VM) you are using as part of your business requirement like 1 GB, 5 GB, 10 GB, etc.

Pricing tier includes what are features you are using and how much you are paying for that.

Below are few categories based on the pricing and features

Shared computeFree and Shared– These are the two base tiers, that runs an app on the same Azure virtual machine as other App Service apps. Apps for the other customers also run on the same virtual machines.

These two basic tires are meant only for development and testing purposes.

Dedicated compute: Basic, Standard, Premium, PremiumV2, etc – Here the apps under this plan run on the dedicated virtual machines. Apps from the other customers are not allowed to run here.

The PremiumV2 tire is the new one that provides virtual machines with faster processors, SSD storage and double memory features.

PremiumV2 features includes all the Premium features with some extra features.

The virtual machines under this PremiumV2 features comes with the below three sizes

  • Small (1 CPU core, 3.5 GB memory)
  • Medium (2 CPU cores, 7 GB memory)
  • Large (4 CPU cores, 14 GB memory)

Isolated: This is tier that runs with dedicated Azure virtual machines on dedicated Azure Virtual Networks

App Service Plan Cost

For App Service plan, there is an hourly charge for all the tires except the Free tire plan

In the Shared tier, Based on CPU minutes you will get charged per hour.

For BasicStandardPremiumPremiumV2 tires, you need to pay for each VM instances per hourly basis.

In the Isolated tier, you need to pay for each worker in a hourly basis.

I have written an article on that. For more information on the pricing details refer to How to create an Azure web app using PowerShell

Azure Web App Example

Find an Example of Azure Web App now.

What Is Azure App Service

Azure App Service is an excellent web hosting service from Microsoft that helps you to build starting from small to large applications. Not only that, but it also helps to build different services and APIs.

Provides you with different Plans like Free, Basic, Standard, Premium, Isolated, etc. and you need to choose the one based on your need.

Key Features Of Azure App Service

Below are the list of a few key features of Azure App Service.

  • Provides you zero-downtime deployments.
  • High security.
  • You will get a dedicated App environment.
  • Can easily integrate with Virtual Networks.
  • This service is fully managed by Microsoft. Microsoft takes care of the maintenance, patching, Security, etc.
  • Flexible pricing options available. You can choose the plan based on your need.
  • It provides you built-in monitoring facility.

Azure App Service Pricing

The Azure App Service based on the Pay as you go pricing model. It provides you with multiple plans like Free, Basic, Standard, Premium, Isolated, etc.

Each plan has different features and price.

FreeBasicStandardPremiumIsolated
It’s Free.You need to pay ₹1.225 per hourYou need to pay ₹6.845 per hourYou need to pay ₹7.277 per hourYou need to pay ₹20.533 per hour

Check out Azure App Service Pricing for the complete information on Pricing and the provided features.

You may like following Azure tutorials:

Conclusion

In this Azure tutorial, We discussed

  • Benefits Of Azure Web App
  • Azure Web App Tutorial
  • What is Azure web app?
  • Difference between Azure web app and Azure app service (Azure web app vs App service)
  • Azure web App architecture
  • web app authentication and authorization in Azure
  • Enable the web app authentication and authorization for the back end application
  • Enable the web app authentication and authorization for the front end application
  • Grant permission to the front end to access to the back end
  • App Service Configuration to return a user access token
  • Call API from the server code
  • Azure web app service plan
  • Azure Web App Example
  • What Is Azure App Service
  • Key Features Of Azure App Service

Hope you enjoyed this article !!!