Article

Ask the expert: Azure services for developers

By Barry Luijbregts    |    July 10, 2017

Is your Azure strategy adding business value to your customers? It should be.

In a recent live webinar, Pluralsight author Barry Luijbregts discussed how you can create a customer-driven strategy using Azure services in order to provide the most value. Since Barry wasn’t able to address every question during the live Q&A after the webinar, he’s followed up with answers to six common questions. Here’s what the Azure expert has to say:

1. What is the difference between Azure Web Apps and API Apps?

Before November of 2015, API Apps had the unique capability to provide CORS (Cross Origin Resource Sharing) and an API definition (using Swagger). These capabilities enabled you to host an API and expose that to the world. After November 2015, these capabilities became available to all App Service types, including Web Apps and Mobile Apps, leaving API Apps in a weird place. 

API apps have no unique capabilities, other than they provide a different icon in the Azure Portal. So there is no real difference between Web Apps and API Apps. My advice: if you want to host an API in Azure, use Azure Web Apps. 

2. Is it correct that Azure Functions are best suited for running lightweight blocks of code?

Azure Function Apps are part of Azure App Services. Just like Azure Web Apps, API Apps, Mobile Apps and some say Logic Apps. An Azure Function App contains one or more Azure Functions. 

Azure Functions are meant to run small pieces of logic that, ideally, run fast, without using a lot of resources. These are small tasks, like resizing an image or translating a sentence. Azure Functions helps you to run these small tasks by providing capabilities like input triggers and in/out data bindings. These allow the Azure Function to be triggered by an outside source, like a new message on an Azure Storage Queue. They also allow you to easily consume data from triggers and write the result to an external data source, like Azure Storage, without writing all the plumbing to connect to these triggers and data sources. 

Azure Functions represent small tasks, like API calls. These usually run fast. If that is the case, you should use the dynamic pricing model to run your functions. This means that you pay for a function when it is executed. If no functions are executed, you pay nothing. 

You can run functions for up to 5 minutes before they time-out. If you need to run longer running tasks, like long data churning tasks, you could still use Azure Functions. In this case, you would run them using the App Service pricing model, which means that you pay a certain amount for the function each month, regardless if it runs or not, just like you pay for a Web App, regardless of if you have any users. 

So Azure Functions are meant for small tasks (running lightweight blocks of code), but they can be (mis)used by running long tasks. Personally, I do run some long running tasks using Azure Functions. I do feel that if you need to run a large, resource-intensive task, you should look into running it in either a VM or something like Azure Service Fabric (although the latter introduces additional complexity) or Azure Data Factory (for moving and transforming data at scale).

3. It seems hard to create multi-tier web solutions with Web Apps where you can isolate the backend from the internet. Is there a PaaS solution for this?

In a multi-tier web application, you often have a database of services that are used by your Web App. Ideally, you want these services to only be exposed to the Web App and not to the internet. The Web App itself is often internet-facing, as it provides the entry point for users. 

To isolate the backend from the internet, you can use a Virtual Network (VNET), which is a service that Azure provides. You can ‘wrap’ your backend services in a VNET and connect your Web App to it as this article describes. This way, the backend is only exposed to the Web App and not to the internet. 

Sometimes, you want even more control. Maybe you want your Web App to be ‘wrapped’ in a VNET so that you can control access to it. Maybe you want it to be called by another Web App and have it be part of your backend. For this scenario, you can use an Azure App Service Environment (ASE). This is available for App Services in the premium pricing tier only and enables you to have a very high scale and have control over isolation and network access. So yes, there is a PaaS solution for this – in the form of Azure App Service Environment. 

4. I need to store audio files. Should I use Azure Blob storage or Azure File storage?

Audio files are a great example of unstructured data. Azure Blob Storage is a good place to store these files, especially if you want to make these files available to the public. If you do, you can configure the Azure Blob Container to be publicly available. If you don’t, you can also have the Blob Container not be publicly available.

Besides the ease of making blobs available to the public, I feel that Blob Storage fits this scenario best because you are looking to store and retrieve files from an application (I assume). 

If you were looking to manipulate these files from a VM, then, Azure File Storage would be more appropriate, as that is more geared to be used as a disk that you mount in a VM.

5. What is Azure Government?

Microsoft Azure Government is basically a “special edition” of the Microsoft Azure cloud. It is similar to the public offering that you and I use, but it is meant to be used by US government agencies and private entities with data subject to regulations. It is only available in the USA.

You can’t just start using it, you have to be approved by Microsoft through a strict validation process.  

Azure Government is run separately from the Azure public cloud, in its own “instance”, meaning that it runs on separate servers and a completely separate infrastructure. Azure Government has more compliance than the public cloud, which covers things like the DoD Impact Level 5 PA

6. How can I calculate the costs for using Azure services?

You can do that with the Azure Pricing Calculator. Here, you can add services that you are planning to use and how much you are planning to use them and it will give you a price. For me and my customers, this has proven to be pretty reliable. Here are some things to keep in mind while calculating your pricing:

  • If you are used to prices in your Azure subscription that is tied to an MSDN subscription, you might think that the prices of the calculator aren’t correct. That is because resources that you get with MSDN credits come at a reduced price. The prices in the calculator are the prices that you pay when you have a pay-as-you-go subscription.
  • In addition to calculating your actual scenario, make sure to calculate the pricing for the worst case scenario. This way, you know what the pricing could be if your app is a massive success.
  • Make sure that you calculate the costs of outgoing data (data that flows from Azure to your users and applications). This is not included in the pricing calculator, but it can become costly. You get the first 5 GB / Month for free and then you start to pay. This is particularly relevant when you are using Azure in a hybrid scenario (e.g. data in Azure, website or API somewhere else). Data going into Azure data centers is free.

Still have questions? Check out the on-demand webinar to discover which Microsoft Azure services are meant for specific scenarios—watch it here.

For other questions, reach out to Barry on Twitter @AzureBarry, or explore his Pluralsight courses.

About the author

Barry is an independent software architect and developer with a passion for the cloud. He is also a Pluralsight author and a podcast host. He has worked for lots of companies throughout the last decade and is keen to share his knowledge with the community. He has a broad and deep knowledge of the Microsoft stack with a special interest in web technology and the cloud. He currently teaches people about the benefits of the cloud. He lives in the Netherlands with his beautiful wife and kids and loves to play with their two Siberian huskies. You can reach Barry on Twitter @AzureBarry and through his website at https://www.azurebarry.com/ and check out his podcast “Developer Weekly” in your favorite podcast app or at https://www.developerweeklypodcast.com/.