How to use Azure Cloud services for your apps

DevToolsGuy / Wednesday, January 13, 2016

With Azure, it is very easy to host your web apps in the cloud. In the old days before the cloud, you would have had to set up a service, configure networking, and add the required libraries as well as various other tricky steps.

Initially, Microsoft’s service for hosting websites was called Azure Websites. In March 2015 however, Microsoft combined several services - amongst them Azure Websites - into the broad Azure App Service. This service enables you to host any app in the cloud - from web apps to mobile apps. The great thing about this is that you don’t have to worry about load balancing, networking, or storage because everything is maintained for you by Azure. Autoscaling will automatically scale the app based on demand.

In this post we’ll look into how to build, deploy, and maintain your apps using Azure App Services. This includes an overview of different app types, the different services in Azure you can leverage, the Azure SDK, and finally how to debug, test and publish your creation.

Four different types of apps

Azure App Service allows you to create four different types of apps:

No matter what type of app you want to create, every app can benefit from the advantages of being hosted in Azure.

Decrease effort using Azure services

Azure provides developers with a lot of services that are common in any app. Some examples:

  • Azure Blob Storage: Store your blob-like images, CSS, JS, custom files, etc., and access them using the Azure SDK.
  • Azure CDN: Host your static resources like CSS, JS, and images using Azure CDN. This will increase the speed of your app, as the resources are loaded from a server closest to the user.
  • Azure Search: Easily implement searching in your app using Azure Search. Search is important in many apps, but can be complex to implement. Azure Search allows you to index your content easily and provides an API to search this indexed data.
  • SQL Database: Store your relational data in SQL by adding an SQL database to your app.
  • Application Insights: Find out how popular your app is, how people use it, and monitor the app performance with the new Application Insights app.

This is just a small extract from all the available services.

The Azure SDK: Makes your life easier

Over are the days when Microsoft only focused on software for Microsoft products. The same is true for the Azure SDK: it is now available for a wide variety of platforms, like Java, Node.js, PHP, and of course .NET. Download the SDK from the Microsoft website to get started.

The SDK allows you to leverage any Azure service: for example to store files in the Azure Blob Storage, record an action for the Application Insights or fire a query to Azure Search. The SDK also enables you to publish your apps to Azure and make them available for the entire world.

How to debug using Visual Studio

A major part of development and issue analysis is the debugging of your app. Microsoft has made it very easy to debug apps (or Azure VM) from Visual Studio. A key thing to note is that Azure’s pricing model is based on usage. To avoid debugging from becoming expensive, it is possible to host any Azure services locally before deploying to the cloud. See here for how to debug an Azure service on your local machine.

The next step is to deploy the service to the cloud, and debug from Azure. Your app can still be deployed locally, but the leveraged Azure services are deployed to Azure in the cloud. See here for how to do so.

When an app has been published, and you want to investigate a reported issue, you don’t have to dig through millions of lines of log files any more. Visual Studio allows you to enable IntelliTrace logging, and by doing so you can replay any action and step through the code. This comes in very handy when you cannot replicate a certain issue which is reported by certain users. Enable IntelliTrace logging, let the user replicate the issue, and step through the code to analyze the problem. For more information and detailed step-by-step instructions have a look here.

Less stress about infrastructure, more focus on developing

By leveraging Azure to build, test, and publish your apps, you will have more time to actually develop them, instead of wasting time on infrastructure, because Azure eliminates the effort required to set up infrastructure to host apps. Besides this, Azure Services makes the app building process even easier by providing commonly used features like Analytics, Search, and Storage. This is all good news - it means you spend less time on the boring parts and more time making your app look and feel amazing!