Azure – Connect to Key Vault from .Net Core application using Managed Identity – Part2 – App Service – Creating App Service from Azure Portal

Azure App Service

Hi All,

LIFE IS BEAUTIFUL 🙂 I hope we all are safe:) STAY SAFE, STAY HEALTHY 🙂 STAY HOME 🙂

Use Case: We have application where we need to use azure app client secret key and certificate for accessing Microsoft Graph APIs. So we decided to use the Azure Key Vault service to store azure app client secret key and certificate for security reasons. But then again to fetch the client secret key and certificate from Key Vault service we need to authenticate and here Managed Identity service come to picture 🙂

Since this article going to be big lets divide this articles into series. This is second article in this series: We will explore Azure App Service and create App Service from Azure Portal

If you didn’t got a chance to go through first article, kindly please have a look once – Azure – Connect to Key Vault from .Net Core application using Managed Identity – Part1 – Introduction to Azure Key Vault

So lets begin the fun 🙂

Take Away from this article: At the end of this article, we will got to know

  • What is Azure App Service?
  • What are WebJobs? Types of WebJobs?
  • How to create Azure App Service from Azure Portal?

Prerequisites:

  • An Azure Account with Active subscription. We can create trial account as well

Azure App Service :

  • Azure App Service is Platform as a Service Model (PAAS), automatically manages OS, languages and framework.
  • We only need to focus on our business logic, Azure takes care of platform
  • HTTP-based service for hosting web applications, REST APIs, and mobile backends
  • Its also like in On-Premises environment we host our web application in IIS or we schedule our console applications (background jobs) in Task Schedule, here in Azure we use App Service for the same
  • Azure App Service offers high availability and auto-scaling
  • Azure App Service supports both platform Windows and Linux
  • Azure App Service multiple languages and frameworks such as ASP.NET, ASP.NET Core, Java, Ruby, Node.js, PHP, Python.
  • Azure App Service also supports scheduling of background job as WebJob, which are going to demonstrate in this series
  • We could manage our Apps using Azure PowerShell or Azure CLI
  • Security – App service is ISO, SOC and PCI compliant. We could authenticate users with Azure AD, with social logins such as Google, Facebook, Twitter, Microsoft.

What are WebJobs:

  • WebJobs is a service which allows us to run background job or script
  • WebJobs can be triggered manually
  • WebJobs can be triggered by schedule
  • WebJobs can be triggered by external event such as new message arrives in a queue
  • There are two types of WebJobs
    • Continuous WebJobs
      • This job starts immediately when job is created
      • These jobs support remote debugging
    • Triggered WebJobs
      • This job either starts manually or need to schedule
      • These job dosent support remote debugging
  • In our application we are going to create Triggered WebJobs. In next article we will host our console application as Triggered WebJobs in newly created Azure App Service
  • Following file types are supported by WebJobs
    • .cmd, .bat, .exe (using Windows cmd)
    • .ps1 (using PowerShell)
    • .sh (using Bash)
    • .php (using PHP)
    • .py (using Python)
    • .js (using Node.js)
    • .jar (using Java)

Creating Azure App Service from Azure Portal:

Azure - Azure Portal
Fig : Azure – Azure Portal – Azure App Services dialog
  • On the Azure Portal we will see an link “App Services” as shown in above Fig
  • If we will hover on “App Services”, “App Services” dialog will appear which details out the recent App Services created, Useful links, Free training from Microsoft. It also shows the options for “+ Create” and “View” the for creating new App Service and to view the listings of App Services
  • Lets create new App Service – click on “+ Create” link from the “App Services” dialog.
  • We will be redirected to “Create Web App” page – https://portal.azure.com/#create/Microsoft.WebSite as shown in below Fig
Azure - Creating new Azure App Service
Fig : Azure – Creating new Azure App Service
  • On “Create Web App” page we need to specify the details for App Service such as
    • Resource Group – Logical unit of Azure resources. We have very good article on Azure Resource Group – Azure – Resource and Resource group . Here we have created new Resource Group – KnowledgeJunction
    • Name – Name of Azure App Service
    • Publish – Code.
    • Runtime stack – In App Service, the Windows instance already have all the supported .NET Core versions as shown in below Fig. Here we are selecting .NET Core 3.1 (LTS)
    • Operating system – Either Linux or Windows
    • Region – Data center where the Web Job will be hosted
Azure - Creating App Service, the Windows instance already have all the supported .NET Core versions
Fig: Azure – Creating App Service, the Windows instance already have all the supported .NET Core versions
  • Once we have all the details in place, click on “Review + create” button which is at bottom as shown in above Fig
  • We will be redirected to summary page as shown in below Fig
Creating new Azure App Service - Summary page
Fig : Azure – Creating new Azure App Service – Summary page
  • If everything look ok, please click on “Create” button as shown in above Fig. Otherwise click on “< Previous” button and update the details
  • Once we click on “Create” button, deployment of our new App Service starts as shown in below Fig
Azure - Deployment in progress - for new App Service
Fig : Azure – Deployment in progress – for new App Service
  • Lets wait till deployment goes on. If App Service created successfully we will get a message “Your deployment in complete” as shown in below Fig
Azure - Deployment completed - new App Service created successfully
Fig : Azure – Deployment completed – new App Service created successfully
  • By clicking on “Go to resource” button as shown in above Fig, we will be redirected to “App Service” details page as shown in below Fig
Azure - App Service details
Fig : Azure – App Service details
  • We have various options and details available on App Service details page.
  • Options like “Browse”, “Delete”, “Start / Stop” and so on.
  • Important details includes, URL to brows the web application, Status, Location and so on.
  • Click on “Browse” button or copy the URL as shown in above fig and we could navigate the Web App as shown in below Fig
Azure - Browsing newly created App Service
Fig : Azure – Browsing newly created App Service

Next Article: In next article, we will create sample .NET Core console application and host as WebJob in this newly created App Service.

We have very good series on Azure, lots of discussion on Azure, please visit – https://knowledge-junction.com/?s=azure

Thanks for reading 🙂 If its worth at least reading once, kindly please like and share. SHARING IS CARING 🙂Share in Teams:

Share in Teams:

Enjoy the beautiful life 🙂 Have a FUN 🙂 HAVE A SAFE LIFE 🙂 TAKE CARE 🙂

One thought on “Azure – Connect to Key Vault from .Net Core application using Managed Identity – Part2 – App Service – Creating App Service from Azure Portal

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: