Introduction to Azure and .NET

This document provides an overview of key concepts and services .NET developers should be familiar with to get started developing apps using Azure services.

Key Concepts

Azure account: Your Azure account is the credential you use to sign into Azure services, such as the Azure Portal. If you don't have an Azure account, you can create one for trial.

Azure subscription: A subscription is the billing plan within which Azure resources are created. Subscriptions can be individual subscriptions or enterprise subscriptions managed by your company. Your Azure account can be associated with multiple subscriptions. In this case, make sure you're selecting the correct subscription when creating resources.

Resource group: Resource groups are a way to organize your Azure resources into groups for management. Resources created in Azure will be stored in a resource group, similar to saving a file in a folder on a computer.

Hosting: To run code in Azure, it needs to be hosted in a service that supports executing user-provided code.

Managed services: Azure provides some services where you provide data or information to Azure, and Azure's implementation takes the appropriate action. One example is Azure Blob Storage, where you provide files and Azure handles reading, writing, and persisting them.

Azure SDK for .NET collectively refers to the NuGet packages you install in your project that provide various interactions and functionality with Azure services. These packages also include management libraries used to provision and administer the resources.

Choosing a hosting option

Hosting in Azure can be divided into three categories.

  • Infrastructure-as-a-Service (IaaS): With IaaS, you provision the virtual machines you need along with associated network and storage components. You then 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, including the operating system, custom software, and security updates.

  • Platform-as-a-Service (PaaS): PaaS provides a managed hosting environment where you 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): Commonly referred to as serverless computing, FaaS goes even further than PaaS in abstracting the concerns of the hosting environment. Instead of creating compute instances and then deploying code to those instances, you 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 is a FaaS service.

Generally, the more your application favors FaaS and PaaS models, the more benefits you'll see from running in the cloud. Below is a summary of three common hosting choices in Azure and when to choose them.

Choose a data storage service

Azure offers several services for storing your data depending on your needs. The most common data services for .NET developers are:

Connect to Azure services

If you use Visual Studio, you can add support for certain Azure services to your projects. The Connected Services dialog in Visual Studio provides an easy way to add all the required references, connection code, and configuration settings to your projects. Some commonly used Azure services are supported out of the box, such as Storage, Azure Active Directory authentication, Azure Key Vault, and Cognitive Services such as Computer Vision. More services, including third-party services, are available as extensions in the Visual Studio Marketplace.

Using the Azure SDK for .NET

If you're using the Azure SDK for .NET to access or manage your Azure resources, please note the following:

  • Authentication: Many libraries in the SDK use a common authentication infrastructure, while some libraries use authentication mechanisms specific to the service they're consuming. For more information, see Authentication with the Azure SDK for .NET.
  • Logging: If supported, the client libraries include the ability to log client library operations. For more information, see Logging with the Azure SDK for .NET.
  • REST API: The Azure SDK for .NET is an abstraction built on the Azure REST API. The Azure REST API may be used in lieu of or alongside the Azure SDK for .NET if desired.

Diagnosing problems in the Cloud

Once you deploy your application to Azure, you may run into cases where it worked in development but doesn't in Azure. Below are two good places to start when diagnosing issues:

  • Remote debug from Visual Studio: Most Azure compute services (including the services discussed in this document) support remote debugging with Visual Studio and acquiring logs. To explore Visual Studio's capabilities with your application, open the Cloud Explorer tool window by typing 'Cloud Explorer' into Visual Studio's quick launch toolbar (in the upper-right corner), and then locate your application in the tree. For details, see Troubleshoot a web app in Azure App Service using Visual Studio.

Next steps