Up and Running with Azure App Service
Tags: azure, serverless, webdev, node
Published: 2020-10-06 05:58:40

This article was originally published at: 
https://parveensingh.com/up-and-running-with-azure-app-service/

----

Are you still running your web servers on Linux or Windows-based VMs in the cloud? When was the last time you checked how much resources your web app is using and whether you need to scale it up or down to improve performance or save cost? Probably, not so often!

The whole point of being in the cloud is leveraging the ability to run scalable and resilient infrastructure without compromising user experience. If you are using cloud services and still practicing the traditional route of using VMs instances for development, you clearly haven't migrated to the cloud yet! Start using the services that are built for the purpose so that you uncover all the possibilities of improvement and enhancement in your application that you would not think of otherwise.

In this article, I'll be providing a high-level overview of the exact tools that you need to build modern, scalable, resilient, and redundant applications all with cost-saving in mind so that you only pay for what you use.

# What is Azure App Service?

Microsoft provides a solution to host web-based services in form of application, REST APIs, or mobile backend known as Azure App Service. It's similar to a web server, but here you only focus on your code instead of updating your host for patches every other week. With the wide range of support for the language, you can deploy your application in .NET, .NET Core, Java, Python, Ruby, PHP, or Node.js. App Service support running application at scale on either Windows or Linux based environment.

App Service is **the easiest way** of running your application in Azure as it lets you focus on creating the application code, not on running it. Let's see what App Service can do and how it can solve your application needs.

# App Service Capabilities and Functionality

Azure App Service includes a wide variety of functionality including auto-scaling, load-balancing, automated deployment, and security integration with Azure AD. As the demand for CI/CD and automation increases, App Service lets you configure those DevOps capabilities and configure the deployments using GitHub, Azure DevOps, Docker Hub, and may other sources..

Let's explore some of the core features that App Service offers and how you can leverage them to solve your business needs.

## App Service Plan

As with any traditional web service, you need a hosting server where the code will be published and hosted. Azure offers that with "**App Service Plan**" that provides you with a fully isolated and dedicated environment to securely run your applications at a high scale. Think of this as Azure VM running in a secure environment that is fully managed by Azure.

As of today, you can choose from the following pricing tier for using an app service plan.

- **Shared Compute**: App Service Plan offers two-tier on shared compute, **Free** and **Shared** which runs your services on the same Azure VM, sharing the underlying host instance. The resources are allocated for each customer instance that runs on the shared resource based on the chosen tier.
- **Dedicated Compute**: If you choose to run your service on a dedicated host, you get three tiers to choose from. The **Basic**, **Standard,** and **Premium** tier offers you a dedicated host that hosts only the services you choose to run on top of them.
- **Isolated Instance**: If you ever need to run your service or application without any connection or exposure to other instances in the same Azure network, **Isolated Instance** provides you with a fully isolated compute option running on a dedicated Azure virtual network which can integrate with your local virtual network for network-level isolation.

## Operating System Support

With the mixture of Linux and Windows-based web services in the cloud, App Services also allows you to choose the type of operating systems that you need so that your application architecture doesn't suffer and it provides the same runtime environment that your application needs for your code to function properly.

Since the App Service is a managed service, you don't get direct access to the host operating systems that the apps run on. Likewise, if you are hosting a container in App Service, you still get full access to your container instance through but not the host it runs on.

## Deployment Slots

Deployment Slot is one of the features in App Service that provides more value than you'd expect. It lets you create a slot for your application and act as a fully-functional version of your production application. It gives you an opportunity to test your application in your App Service environment before pushing directly to production.

Let's suppose your application takes 2-5 minutes(may vary in your case) to warm up and perform initial tasks before it's functional, you would not want your customers to wait for that long whenever a new update is released. That's where you'd use Deployment Slot by creating a new slot and switch the slot with your production app when your application is ready and running as normal. It is as simple as clicking one button to switch your slots and push your code to production.

Check out more details at the link below:

[https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots?WT.mc_id=parveensingh.com](https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots?WT.mc_id=parveensingh.com)

## Deployment Center

Are you already using GitHub or Azure DevOps as your code repository? If yes, Integrate it right within your application and get a seamless deployment experience without any complex setup. 

Deployment Center enables you to connect your Application with any repository for continuous delivery and code change updates. App Service supports continuous deployment from Azure DevOps, GitHub, and Bitbucket where app services pull the latest changes seamlessly from the source control to keep your app code up to date.

More information at the link below:

[https://docs.microsoft.com/en-us/azure/app-service/deploy-continuous-deployment](https://docs.microsoft.com/en-us/azure/app-service/deploy-continuous-deployment)[?WT.mc_id=parveensingh.com](https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots?WT.mc_id=parveensingh.com)

## Scale Up-Out

How would you scale your application if it's running on an Azure VM? Probably shut it down and resize, right? Hold right there!

The scale-out feature has just the right configuration that you need for your application to scale automatically without even touching it. Whether you want 1 or 10 instances of your application, the auto-scaling feature provides you just that with a simple rule setup defined with pre-configured conditions that will trigger resource creation and destruction based on the workload of your application.

See what else can you do with Scaling in Azure:

[https://docs.microsoft.com/en-us/azure/app-service/manage-scale-up](https://docs.microsoft.com/en-us/azure/app-service/manage-scale-up)[?WT.mc_id=parveensingh.com](https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots?WT.mc_id=parveensingh.com)

## Authentication and Authorization

If you are building any production running application, chances are that you are either handling the Authentication and Authorization in your code or using a third-party module to support that feature. Luckily, Microsoft provides you with direct integration of application authorization and authentication without you worrying about all the maintenance and management.

Since App Service uses the Federated Identity, you can integrate any major identity provide in your codebase like Azure Active Directory, Microsoft Account, Facebook, Google, and Twitter along with support for other OpenID Connect providers as well.

More in-depth information below:

[https://docs.microsoft.com/en-us/azure/app-service/overview-authentication-authorization](https://docs.microsoft.com/en-us/azure/app-service/overview-authentication-authorization)[?WT.mc_id=parveensingh.com](https://docs.microsoft.com/en-us/azure/app-service/manage-backup?WT.mc_id=parveensingh.com) 

## Backups

Backups are a crucial part of running the application in production where you'd want to make sure you have a safe copy of your application in case you need to roll back to the previous date. App Service provides you with an in-built option to enable backups for your application with support for one-click restore to either a different application or overwriting existing app.

Check out more in-depth information on the article below: 

[https://docs.microsoft.com/en-us/azure/app-service/manage-backup?WT.mc_id=parveensingh.com](https://docs.microsoft.com/en-us/azure/app-service/manage-backup?WT.mc_id=parveensingh.com)

## Custom Domains and SSL

If you are running your application in Azure, you should set up your own domain as an entry point instead of azurwebsites.com subdomain provided by Microsoft for free. App Service allows you to either purchase a domain directly from the app service options or connect your existing domain by verifying the domain membership.

Domain Verification usually involves adding a CNAME and A record for either root or subdomain based on what you are adding. Since Shared Infrastructure is intended to be used for development only, Custom Domain is not supported in "**F1 Shared Infrastructure**" as you'd need to be on at least "**D1 Shared Infrastructure**" plan to support the customer domain and **B1 Plan**, if you want to bind an SSL certificate to your application.

Refer to the article below for more information: 

[https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain](https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain)[?WT.mc_id=parveensingh.com](https://docs.microsoft.com/en-us/azure/app-service/manage-backup?WT.mc_id=parveensingh.com)

## Application Insights

Is your application performing the way you expect it to? Well, App Service got Application Insights that you tell you exactly what you need to know from the hardware level to application-level diagnostics of your application. All it takes is to add a simple piece of code to your application and let the data come through application insights where you can monitor the real-time performance of your application. How cool is that?

# Conclusion

I hope you got at least a brief overview of what Azure App Service is. I'll be covering in-depth tutorials in the coming weeks on using CI/CD Pipelines with Azure App Service.


> Looking for information or article on any particular Azure Service? Leave a comment down below or reach out to me on [Twitter](https://twitter.com/singh_cloud).