Azure App Service in action

In the real world, there are generally two possibilities for hosting your web applications or APIs in the cloud. You can follow the classic model and deploy your apps on a virtual machine, or you can go “serverless” by using a serverless platform as a service (PaaS) on a cloud platform.  Following my last blog post that provided an overview of Microsoft Azure services, in this post, I’d like to introduce Azure App Service, and more specifically four general ways to host your web application on Azure:

  • Azure App Service
  • Virtual Machines
  • Service Fabric
  • Cloud Services

Before we start with one of the most important services on Microsoft Azure, Azure App Service, we should understand the concept of ‘serverless computing.’

What is Serverless computing?

Serverless computing, also known as function as a service (FaaS), is a cloud computing code execution model that allows you to build and run applications and services without having to manage infrastructure.  Even though your application still runs on servers, you no longer to have a global “infrastructure vision” to provision, scale, and maintain servers to run your applications, databases, and storage systems. With serverless, all of these things would be handled by your cloud platform. To know more about serverless computing, the Cloud Academy learning path Getting Started with Serverless Computing is a great resource to help you dive in.

Azure App Service

App Service is a PaaS service offered by Microsoft Azure. App Service helps you create web and mobile apps for any platform or device. It also helps you integrate your apps with SaaS solutions, connect with on-premise applications, and automate your business processes. After deploying your application with App Service, Azure runs your apps on fully managed virtual machines (VMs), with your choice of shared VM resources or dedicated VMs.

Currently, Azure App Service offers several app types and capabilities:

  • Web apps: Web-based applications that can scale with business requirements
  • Mobile Apps: Mobile applications that can run on any device
  • Logic apps: Used for automating business processes and integrating systems and data across clouds without writing code
  • API apps: Used for hosting RESTful APIs that other services can leverage, such as in IoT scenarios
  • Functions: Event-based development and deployment that allow you to define functions that trigger specific events in App Services such as spinning up an application under specific circumstances, reducing overall costs

App Service plans represent the collection of physical resources used to host your apps.
App Service plans include:

  • Region (West US, East US, etc.; Designed for high availability)  
  • Scale count (one, two, three instances, etc.; Designed for horizontal scalability)
  • Instance size (Small, Medium, Large; Designed for vertical scalability)
  • SKU (Free, Shared, Basic, Standard, Premium; Designed for cost-efficiency )

Web Apps, Mobile Apps, Function Apps, or API Apps in Azure App Service all run in an App Service plan. Apps in the same subscription and region and resource group can share an App Service plan.
All applications assigned to an App Service plan share the resources defined by it, allowing you to save on costs when hosting multiple apps. To learn more about how to manage your App Service plan, please refer to this overview of Azure App Service plans.

Take a look at Cloud Academy Introduction to Microsoft Azure App Service to get started.

App Service deployment options

Since everything on the cloud is going to be “serverless,” deploying your app to App Service is just a matter of deploying your code, binaries, content files, and their respective directory structure. App Service supports three different deployment processes:

  • FTP or FTPS: Use your favorite FTP or FTPS enabled tool to move your files to Azure, from FileZilla to full-featured IDEs like NetBeans.
  • Kudu (Git/Mercurial or OneDrive/Dropbox): Use the deployment engine in App Service. Push your code to Kudu directly from any repository.
  • Web Deploy: Deploy code to App Service directly from your favorite Microsoft tools such as Visual Studio using the same tooling that automates deployment to IIS servers.

Azure documentation is always your best resource for learning more. In this case, refer to this article for how to Deploy your app to App Service to get more information.

Continuous deployment with App Service
To facilitate continuous deployment, Azure App Service integrates with BitBucket, GitHub, and Visual Studio Team Services (VSTS) and enables a continuous deployment workflow where Azure pulls in the most recent updates from your project published to one of these services. To learn more about how to configure a continuous deployment workflow for your Azure App Service app, please refer to this article: Continuous Deployment to Azure App Service.

Staged deployment with App Service

When you deploy your web app, mobile back-end, and API app to App Service, you can deploy to a separate deployment slot instead of the default production slot when running in the Standard or Premium App Service plan mode.
Deployment slots are actually live apps with their own hostnames. App content and configuration elements can be swapped between two deployment slots: the production slot and non-production slot. Refer to this article to Set up staging environments in Azure App Service.

Be careful: When you clone configuration from another deployment slot, some configuration elements will follow the content across a swap (not slot specific) while other configuration elements will stay in the same slot after a swap (slot specific). Each App Service plan mode supports a different number of deployment slots. To find out the number of slots that your app’s mode supports, see App Service Pricing.

App Service in action: How to design and deploy

Azure App Service is the best choice for most web apps. Deployment and management are integrated into the platform, sites can scale quickly to handle high traffic loads, and the built-in load balancing and traffic manager provide high availability.
To move existing sites to Azure App Service you can use an online migration tool, an open-source app from the Web Application Gallery, or you can create a new site using the framework and tools of your choice. The WebJobs feature makes it easy to add background job processing to your App Service web app.

Apps in Action: Web app, mobile app or logic app

Let’s take a look at how we can design and implement Web apps, mobile apps and logical apps with Azure App Service in different scenarios.

Azure App Service Web Apps

App Service Web Apps is a fully managed compute platform that is optimized for hosting websites and web applications. In App Service, a web app is the compute resources that Azure provides for hosting a website or web application.

Azure App Service currently supports ASP.NET, Node.js, Java, PHP, or Python, as well as other languages and frameworks. You can run scripts that use PowerShell and other scripting languages. To deploy a web app, we will start by configuring Web Apps settings.  For a web apps, the application settings include: General settings like Framework versions, Platform, Web Sockets, Always On, etc. and app settings, provided by Azure Cloud, to visualize your application environment. Debugging settings allow you do remote debugging with Visual Studio.  Take a look at the Microsoft Azure documentation Configure web apps in Azure App Service for more details.

After configuring your app, you can enable diagnostic logs. App Service web apps provide diagnostic functionality for logging information from both the web server and the web application. These are called Web Server Diagnostics and Application Diagnostics. For more information about diagnostic logging in an app service, refer to this article about Diagnostics Logging in WebApps of Azure App Service.

Watch this short video on Diagnostic logging on Azure (part of the Cloud Academy’s course on
Analyzing Resource Utilization on Azure.

If you don’t plan to configure a custom domain, you can use the default HTTPS certificate (however, it is usually not secure).  Azure App Service provides an easy way to manually map a custom domain name to your web app. With your custom domain, you can also purchase and manage an SSL certificate right from the Azure Portal without ever leaving the portal.

On Azure, we can also manage Web Apps by using Azure PowerShell and Xplat-CLI.

I would recommend reading the following Azure documentation for more information:

Implementing Azure WebJobs

To do regular jobs and batch work in the background under web app, we’re using Azure WebJobs. On Azure, there are three ways to configure WebJobs: on demand, continuously, or on a schedule to run programs or scripts in WebJobs. There is no additional cost to use WebJobs. 

WebJobs accept the following types:
.cmd, .bat, .exe (using Windows cmd)
.ps1 (using PowerShell)
.sh (using bash)
.php (using php)
.py (using python)
.js (using node)
.jar (using java)

Develop Azure App Service Mobile Apps

Mobile Apps in Azure App Service offers a highly scalable, globally available mobile application development platform.
Store data in the cloud
Azure provides a complete set of Client SDKs that cover native development (iOS, Android, and Windows), cross-platform development (Xamarin for iOS and Android, Xamarin Forms) and hybrid application development (Apache Cordova). Each client SDK is available with an MIT license and is open-source. Cloud-enabled mobile development has different features compared to traditional mobile application development:

  • Authentication and Authorization: Integration with different identity providers like Facebook, Google, Twitter, and Microsoft Account or Azure Active Directory and the SDK for provider-specific functionality
  • Data Access: Azure Mobile Apps provides a mobile-friendly OData v3 data source linked to SQL Azure or an on-premise SQL Server
  • Offline Sync: Client SDKs make it easy for you to build robust and responsive mobile applications that operate with an offline data set that can be automatically synchronized with the backend data, including conflict resolution support
  • Push Notifications: Client SDKS seamlessly integrate with the registration capabilities of Azure Notification Hubs, allowing you to send push notifications to millions of users simultaneously

Azure App Service Logic Apps

Just like AWS SWF (Simple Workflow Service), Azure Logic Apps simplify and implement scalable integrations and workflows in the cloud. It provides a visual designer to model and automate your process as a series of steps known as a workflow. To get started with Logic Apps, follow the create a Logic App tutorial.  Also, Azure documentation on how to create a Logic App connecting SaaS services could be helpful. Finally, we can make use of the existing Logic App templates or Create a Logic App using a template.

API in Action: Design Azure App Service API Apps

In general SOA solution projects, we are usually working with three-tier applications: front-end, middle tier, and data tier. Compared to traditional technologies, the cloud provides a much better solution for each tier. We can get great solutions for both front-end (your web apps) and middle tier applications (with your API in ASP.NET web API, Node.js, or other languages).

API apps in Azure App Service offer features that make it easier to develop, host, and consume APIs in the cloud and on-premise. This Azure documentation, Get started with API Apps, ASP.NET, and Swagger in Azure App Service, shows a simple three-tier application example (the famous To Do List). If you’re working more on Java or Node.js, please refer to the following documentation:
Java API :  Build and deploy a Java API app in Azure App Service
Node.js : Build a Node.js RESTful API and deploy it to an API app in Azure

Code in Action: Azure Functions

Just like the AWS Lambda service, Microsoft Azure provides a service, Azure Functions, to listen to and react to the different events on cloud. Azure Functions is a solution for easily running small pieces of code, or “functions,” in the cloud in a serverless way without thinking about an entire application or the infrastructure to run it.

The general scenario for Azure Functions is for processing data, integrating systems, working with IoT, and building simple APIs and microservices.

Implement Azure Functions

Consider Functions for tasks like image or order processing, file maintenance, long-running tasks that you want to run in a background thread, or for any tasks that you want to run on a schedule.
Functions provides templates to get you started with key scenarios such as:

  • BlobTrigger
  • EventHubTrigger
  • Generic webhook
  • GitHub webhook
  • HTTPTrigger
  • QueueTrigger
  • ServiceBusQueueTrigger
  • ServiceBusTopicTrigger
  • TimerTrigger

To learn more about each trigger, take a look at the Azure Functions Overview.

To create your first Azure Functions, you can choose the template in the Quickstart tab or any other trigger template in a new function. For example, to create a function click New function to choose GitHub Webhook – JavaScript to create a webhook function (for step by step configuration, refer to Azure documentation create a webhook or API Azure Function). Or, choose TimerTrigger – C# to create an event processing function, or to choose  TimerTrigger-JavaScript to implement an Azure-connected function.

There are two ways to test your Azure Functions:

  • Create a test function, then test your function with tools such as Postman, Fiddle, or with cURL from the command line if you’ve installed cURL tools. To test a blob trigger function, use Azure Storage Explorer.
  • You can test a function within functions by creating functions to trigger other functions that you are testing.

For more information on testing your Azure Functions step by step, refer Testing Azure functions on Azure documentation.

Next Steps

In my next posts, I will cover how to manage and configure Apps for scale and resilience as well as monitoring your apps on App Service. Stay tuned!

Avatar

Written by

Cloud Academy Team


Related Posts

Alisha Reyes
Alisha Reyes
— October 1, 2019

New on Cloud Academy: ITIL® 4, Microsoft 365 Tenant, Jenkins, TOGAF® 9.1, and more

At Cloud Academy, we're always striving to make improvements to our training platform. Based on your feedback, we released some new features to help make it easier for you to continue studying. These new features allow you to: Remove content from “Continue Studying” section Disc...

Read more
  • AWS
  • Azure
  • Google Cloud Platform
  • ITIL® 4
  • Jenkins
  • Microsoft 365 Tenant
  • New content
  • Product Feature
  • Python programming
  • TOGAF® 9.1
Avatar
Jeremy Cook
— September 17, 2019

Cloud Migration Risks & Benefits

If you’re like most businesses, you already have at least one workload running in the cloud. However, that doesn’t mean that cloud migration is right for everyone. While cloud environments are generally scalable, reliable, and highly available, those won’t be the only considerations dri...

Read more
  • AWS
  • Azure
  • Cloud Migration
Joe Nemer
Joe Nemer
— September 6, 2019

Google Cloud Functions vs. AWS Lambda: The Fight for Serverless Cloud Domination

Serverless computing: What is it and why is it important? A quick background The general concept of serverless computing was introduced to the market by Amazon Web Services (AWS) around 2014 with the release of AWS Lambda. As we know, cloud computing has made it possible for users to ...

Read more
  • AWS
  • Azure
  • Google Cloud Platform
Alisha Reyes
Alisha Reyes
— August 30, 2019

New on Cloud Academy: CISSP, AWS, Azure, & DevOps Labs, Python for Beginners, and more…

As Hurricane Dorian intensifies, it looks like Floridians across the entire state might have to hunker down for another big one. If you've gone through a hurricane, you know that preparing for one is no joke. You'll need a survival kit with plenty of water, flashlights, batteries, and n...

Read more
  • AWS
  • Azure
  • Google Cloud Platform
  • New content
  • Product Feature
  • Python programming
Alisha Reyes
Alisha Reyes
— August 22, 2019

How to Unlock Complimentary Access to Cloud Academy

Are you looking to get trained or certified on AWS, Azure, Google Cloud Platform, DevOps, Cloud Security, Python, Java, or another technical skill? Then you'll want to mark your calendars for August 23, 2019. Starting Friday at 12:00 a.m. PDT (3:00 a.m. EDT), Cloud Academy is offering c...

Read more
  • AWS
  • Azure
  • cloud academy content
  • complimentary access
  • GCP
  • on the house
Avatar
Andrew Larkin
— August 13, 2019

Content Roadmap: AZ-500, ITIL 4, MS-100, Google Cloud Associate Engineer, and More

Last month, Cloud Academy joined forces with QA, the UK’s largest B2B skills provider, and it put us in an excellent position to solve a massive skills gap problem. As a result of this collaboration, you will see our training library grow with additions from QA’s massive catalog of 500+...

Read more
  • AWS
  • Azure
  • content roadmap
  • Google Cloud Platform
Avatar
Andrew Larkin
— August 7, 2019

Disadvantages of Cloud Computing

If you want to deliver digital services of any kind, you’ll need to estimate all types of resources, not the least of which are CPU, memory, storage, and network connectivity. Which resources you choose for your delivery —  cloud-based or local — is up to you. But you’ll definitely want...

Read more
  • AWS
  • Azure
  • Cloud Computing
  • Google Cloud Platform
Orion Withrow
Orion Withrow
— July 24, 2019

How to Effectively Use Azure Management Groups, Subscriptions, and Resource Groups

When used individually, Azure Management Groups, Subscriptions, and Resource Groups are very powerful. But when used together, they can establish the entire organizational structure of Azure. In this article, I will explain Azure Resource Manager, Management Groups, Subscriptions an...

Read more
  • Azure
  • azure management groups
  • azure resource groups
  • azure subscriptions
Alisha Reyes
Alisha Reyes
— July 22, 2019

Cloud Academy’s Blog Digest: July 2019

July has been a very exciting month for us at Cloud Academy. On July 10, we officially joined forces with QA, the UK’s largest B2B skills provider (read the announcement). Over the coming weeks, you will see additions from QA’s massive catalog of 500+ certification courses and 1500+ ins...

Read more
  • AWS
  • Azure
  • Cloud Academy
  • Cybersecurity
  • DevOps
  • Kubernetes
Avatar
Paola Di Pietro
— July 19, 2019

Top 10 Things Cybersecurity Professionals Need to Know

There has been an increase in data breaches over the recent years. With almost 143 million Americans who have had their data compromised in data breaches. These breaches include all sorts of sensitive data, including financial information, election controversies, social security, just t...

Read more
  • Azure
  • cyber security
  • Security
Avatar
Guy Hummel
— June 26, 2019

Running Apache Spark on Azure Databricks

In this article, we’ll cover how to set up an Azure Databricks cluster and how to run queries in an interactive notebook. However, this article only scratches the surface of what you can do with Azure Databricks. If you would like to learn more, including how to create graphs, run sched...

Read more
  • Azure
Avatar
Thomas Mitchell
— June 25, 2019

Understanding the Core Azure Architectural Components

Microsoft Azure relies on a few key architectural components to provide redundancy and high availability. Core Azure architectural components include Azure regions, Azure Availability Zones, resource groups, and the Azure Resource Manager. In this article, we’ll discuss the basics ab...

Read more
  • Azure