Azure is a big cloud with lots of services, and for even the most experienced user it can be intimidating to know which service will best meet your needs. This blog post is intended to provide a short overview of the most common concepts and services .NET developers need get started and provide resources to help you learn more.
Azure Account: Your Azure account is the credentials that you sign into Azure with (e.g. what you would use to log into the Azure Portal). If you to not yet have an Azure account, you can create one for free
Azure Subscription: A subscription is the billing plan that Azure resources are created inside. These can either be individual or managed by your company. Your account can be associated with multiple subscriptions. If this is the case, you need to make sure you are selecting the correct one when creating resources. For more info see understanding Azure accounts, subscriptions and billing. Did you know, if you have a Visual Studio Subscription you have monthly Azure credits just waiting to be activated?
Resource Group: Resource groups are one of the most fundamental primitives you’ll deal with in Azure. At a high level, you can think of a resource group like a folder on your computer. Any resources or service you create in Azure will be stored in a resource group (just like when you save a file on your computer you choose where on disk it is saved).
Hosting: When you want code you’ve written to run in Azure, it needs to be hosted in a service that supports executing user provided code.
Managed Services: Azure provides many services where you provide data or information to Azure, and Azure’s implementation takes the appropriate action. A common example of this is Azure Blob Storage, where you provide files, and Azure handles reading, writing, and persisting them for you.
Choosing a Hosting Option
Hosting in Azure can be divided into three main categories:
- Infrastructure-as-a-Service (IaaS): With IaaS, you provision the VMs that you need, along with associated network and storage components. Then you deploy whatever software and applications you want onto those VMs. This model is the closest to a traditional on-premises environment, except that Microsoft manages the infrastructure. You still manage the individual VMs (e.g. deciding what operating system you want, install custom software, when to apply security updates, etc.).
- Platform-as-a-Service (PaaS): Provides a managed hosting environment, where you can deploy your application without needing to manage VMs or networking resources. For example, instead of creating individual VMs, you specify an instance count, and the service will provision, configure, and manage the necessary resources. Azure App Service is an example of a PaaS service.
- Functions-as-a-Service (FaaS): Often called “Serverless” computing, FaaS goes even further than PaaS in removing the need to worry about the hosting environment. Instead of creating compute instances and deploying code to those instances, you simply deploy your code, and the service automatically runs it. You don’t need to administer the compute resources, the platform seamlessly scales your code up or down to whatever level necessary to handle the traffic and you pay only when your code is running. Azure Functions are a FaaS service.
In general, the further towards Serverless you can host your application, the more benefits you’ll see from running in the cloud. Below is a short cheat sheet for getting started with three common hosting choices in Azure and when to choose them (for a more complete list see Overview of Azure compute options)
- Azure App Service: If you are looking to host a web application or service we recommend you look at App Service first. To get started with App Service, see the ASP.NET Quickstart (instructions are applicable to ASP.NET, WCF, and ASP.NET Core apps).
- Azure Functions: Azure Functions are great for event driven workflows. Examples include responding to Webhooks, processing items placed into Queues or Blob Storage, Timers, etc. To get started with Azure Functions see the Create your first function quickstart.
- Azure Virtual Machines: If App Service doesn’t meet your needs for hosting an existing application (e.g. you need to install custom software on the machine, or access operating system APIs that are not available in App Service’s environment) Virtual Machines will be the easiest place to start. To get started with Virtual Machines see our Deploy an ASP.NET app to an Azure virtual machine tutorial (applies equally to WCF).
If you need more help deciding on which hosting/compute option is best for you, see the Decision tree for Azure compute services.
Choosing a Data Storage Service
Azure offers many services for storing your data depending on your needs. The most common data services for .NET developers are:
- Azure SQL Database: If you are looking to migrate an application that is already using SQL Server to the cloud, then Azure SQL Database is a natural place to start. To get started see the Build an ASP.NET app in Azure with SQL Database tutorial.
- Azure Cosmos DB: Is a modern database designed for the cloud. If you are looking to start a new application that doesn’t yet have a specific database dependency, you should look at Azure Cosmos DB as a starting point. Cosmos DB is a good choice for new web, mobile, gaming, and IoT applications where automatic scale, predictable performance, fast response times, and the ability to query over schema-free data is important (common use cases for Azure Cosmos DB). To get started See build a .NET web app with Azure Cosmos DB quickstart
- Blob Storage: Is optimized for storing and retrieving large binary objects (images, files, video and audio streams, large application data objects and documents, etc.). Object stores enable the management of extremely large amounts of unstructured data. To get started see the upload, download, and list blobs using .NET quickstart.
For more help deciding on which data storage service will best meet your needs, see choose the right data store.
Diagnosing Problems in the Cloud
Once you deploy your application to Azure, you’ll likely run into cases where it worked locally but doesn’t in Azure. Below are two good places to start:
- Remote debug from Visual Studio: Most of the Azure compute services (including all three covered above) support remote debugging with Visual Studio and acquiring logs. To explore Visual Studio’s capabilities for your application type, open the Cloud Explorer tool window (type “Cloud Explorer” into Visual Studio’s Quicklaunch toolbar (in the top right corner), and locate your application in the tree. For details see diagnosing errors in your cloud apps.
- Enable Application Insights: Application Insights is a complete application performance monitoring (APM) solution that captures diagnostic data, telemetry, and performance data from the application automatically. To get started collecting diagnostic data for your app, see start monitoring your ASP.NET Web Application with Azure Application Insights.
Conclusion and Resources
The above is a short list of what to look at when you’re first starting with Azure. If you are interested in learning more here are a few resources:
- Visit our .NET Azure Developer Center
- Read the Azure Quick Start Guide for .NET Developers free e-book
As always, we want to see you successful, so if you run into any issues, let me know in the comment section below, or via Twitter and I’ll do my best to get your question answered.