Get Start de
Get Start de
What is Azure?
Azure is a cloud platform designed to simplify the process of building modern applications. Whether you choose
to host your applications entirely in Azure or extend your on-premises applications with Azure services, Azure
helps you create applications that are scalable, reliable, and maintainable. With extensive support in tools you
already use like Visual Studio and Visual Studio Code and a comprehensive SDK library, Azure is designed to
make you, the .NET developer productive right from the start.
While Azure contains over 100 services, the following Azure services are the services you will use most
frequently as a .NET developer.
For the full list of Azure products and services, visit the Azure documentation home page
Next steps
Start configuring your Azure development environment by Creating an Azure Account
Create an Azure account
3/6/2021 • 2 minutes to read • Edit Online
To use Azure, you need an Azure account. Your Azure account is the credential you use to sign into Azure
services like the Azure Portal or Cloud Shell.
Next steps
After creating an Azure account, be sure to bookmark the Azure Portal in your web browser for easy access to
Azure.
Next, you will want to configure Visual Studio or Visual Studio Code for Azure development depending on which
IDE you use.
Configure Visual Studio for Azure development
Configure Visual Studio Code for Azure development
Configure Visual Studio for Azure development with
.NET
3/6/2021 • 2 minutes to read • Edit Online
Visual Studio includes tooling to help with the development and deployment of applications on Azure. This
guide will help you make sure that you have Visual Studio properly configured for Azure development.
Download Visual Studio 2019
If you already have Visual Studio 2019 installed, you can skip this step.
Download Visual Studio 2019
Install Azure workloads
Launch the Visual Studio Installer and validate that you have the workloads Azure development and
ASP.NET and web development are installed. If either of these workloads is not installed, select these
workloads to install them.
If you are using Visual Studio Code, whether for .NET development, for building single page applications using
frameworks like Angular, React or Vue, or for writing applications in another language like Python, you will want
to configure Visual Studio Code for Azure development.
Download Visual Studio Code
If you already have Visual Studio Code installed, you can skip this step
Download Visual Studio Code
Install the Azure Tools Extension Pack
The Azure Tools Extension Pack contains extensions for working with Azure App Service, Azure Functions, Azure
Storage, Cosmos DB, and Azure Virtual Machines all in one convenient package.
To install the extension from Visual Studio Code:
1. Press Ctrl+Shift+X to open the Extensions window.
2. Search for the Azure Tools extension.
3. Select the Install button.
To learn more about installing extensions in Visual Studio Code, refer to the Extension Marketplace document on
the Visual Studio Code website.
Sign in to your Azure account with Azure Tools
On the left hand panel, you'll see an Azure icon. Select this icon, and a control panel for Azure services will
appear. Choose Sign in to Azure... under any service to complete the authentication process for the Azure
tools in Visual Studio Code.
Next steps
Next, you will want to install the Azure CLI on your workstation.
Install the Azure CLI
Install the Azure CLI
3/6/2021 • 2 minutes to read • Edit Online
In addition to the Azure Portal, Azure also offers the Azure CLI as a command-line tool to create and manage
Azure resources. The Azure CLI offers the benefits of efficiency, repeatability, and the ability to script recurring
tasks.
In practice, most developers use both the Azure Portal and the Azure CLI. Where as the Azure Portal is useful
when exploring new services and getting an overview of all of the resources in your Azure account, most
developers find the Azure CLI to be faster and more efficient. The Azure CLI can often accomplish in a single
command what takes multiple steps in the Azure Portal. In addition, since Azure CLI commands can be saved to
a file, developers can assure that recurrent tasks are run the same way each time.
The Azure CLI is available for Windows, macOS, and Linux.
Install the Azure CLI for Windows
Install the Azure CLI for macOS
Install the Azure CLI for Linux
Azure Cloud Shell
You can also use the Azure CLI in the Azure Cloud Shell at https://shell.azure.com. The Azure Cloud Shell is a
fully functional, browser-based shell for managing Azure resources. The Azure Cloud Shell is useful when you
need a command line environment but are working on a device where you are unable to install the Azure CLI.
Next steps
Next, you will want to install additional Azure tools like Azure Storage Explorer and Azure Data Studio to make
you more productive with Azure.
Additional Tools for Azure Developers
3/6/2021 • 2 minutes to read • Edit Online
In addition to configuring your IDE and installing the Azure CLI, multiple other tools and utilities are available to
help you be more productive with Azure.
Azure PowerShell
Azure PowerShell is a PowerShell module of cmdlets for managing Azure resource directly from PowerShell,
either from the command line or from within PowerShell scripts. Azure PowerShell supports PowerShell
features like PowerShell objects and combining commands into pipelines. If you have used PowerShell before or
need to write complex automation scripts to manage Azure resources, you will want to install Azure PowerShell.
Install Azure PowerShell
Next steps
Validate your development environment is set up correctly using the .NET on Azure development environment
checklist.
.NET on Azure development environment checklist
3/6/2021 • 2 minutes to read • Edit Online
This checklist is provided to help you make sure you have your development environment correctly configured
for .NET development with Azure
This article provides considerations and comparisons between the multiple choices you have in Azure when
migrating your existing .NET Framework applications from on-premises to Azure.
The fundamental areas to consider when migrating existing .NET applications to Azure are:
1. Compute choices
2. Database choices
3. Networking and security considerations
4. Authentication and authorization considerations
Compute choices
When migrating existing .NET Framework applications to Azure you have multiple choices. However, since .NET
Framework depends on Windows, the following choices are limited to Windows-based compute services.
The following table shows several comparisons and recommendations to help you choose the right compute
migration path for your existing .NET application.
Pros & benefits Easiest migration Ongoing PaaS maintenance, Prepared for the
path simplest way to manage future, Cloud
Familiar and scale apps in Azure. DevOps-Ready with
environment. dependencies
Deployment included in the app's
environment is a containers.
VM, so it's similar to Almost no need to
on-premises servers. refactor .NET /C#
code.
A Z URE VM S A Z URE A P P SERVIC E W IN DO W S C O N TA IN ERS
How to migrate See Migrate to Azure See Migrate Azure App Follow considerations,
Virtual Machines Service scenarios, and
walkthroughs explained in
the Modernizing existing
.NET apps with Azure and
Windows Containers eBook
The following flowchart diagram shows a decision tree when planning a migration to Azure for your existing
.NET Framework applications. If it's viable, try option A first, but option B is the easiest path to perform.
Database choices
When migrating relational databases to Azure you have multiple choices. See Migrate your SQL Server database
to Azure to help you choose the right database migration path for your existing .NET application.
Next steps
Migrate an ASP.NET web application to Azure App Service
Migrate your .NET web app or service to Azure
App Service
3/6/2021 • 4 minutes to read • Edit Online
App Service is a fully managed compute platform service that's optimized for hosting scalable websites and web
applications. This article provides information on how to lift-and-shift an existing application to Azure App
Service, modifications to consider, and additional resources for moving to the cloud. Most ASP.NET websites
(Webforms, MVC) and services (Web API, WCF) can move directly to Azure App Service with no changes. Some
may need minor changes while others may need some refactoring.
Ready to get started? Publish your ASP.NET + SQL application to Azure App Service.
Considerations
On-premises resources (including SQL Server)
Verify access to on-premises resources as these may need to be migrated or changed. The following are options
for mitigating access to on-premises resources:
Create a VPN connecting App Service to on-premises resources using Azure Virtual Networks.
Securely expose on-premises services to the cloud without firewall changes using Azure Relay.
Migrate dependencies such as a SQL database to Azure.
Use platform-as-a-service offerings in the cloud to reduce dependencies. For example, rather than connect to
an on-premises mail server, consider using SendGrid.
Port Bindings
Azure App Service supports port 80 for HTTP and port 443 for HTTPS traffic.
For WCF, the following bindings are supported:
B IN DIN G N OT ES
BasicHttp
WSHttp
WSDualHttpBinding Web socket support must be enabled. Web socket support must be enabled.
NetHttpBinding Web socket support must be enabled Web socket support must be enabled
for duplex contracts. for duplex contracts.
NetHttpsBinding Web socket support must be enabled Web socket support must be enabled
for duplex contracts. for duplex contracts.
BasicHttpContextBinding
WebHttpBinding
WSHttpContextBinding
Authentication
Azure App Service supports anonymous authentication by default and Forms authentication when intended.
Windows authentication can be used by integrating with Azure Active Directory and ADFS only. Learn more
about how to integrate your on-premises directories with Azure Active Directory.
Assemblies in the GAC (Global Assembly Cache )
This isn't supported. Consider copying required assemblies to the app's \bin folder. Custom .msi files installed on
the server (for example, PDF generators) cannot be used.
IIS settings
Everything traditionally configured via applicationHost.config in your application can now be configured
through the Azure portal. This applies to AppPool bitness, enable/disable WebSockets, managed pipeline
version, .NET Framework version (2.0/4.0), and so on. To modify your application settings, navigate to the Azure
portal, open the blade for your web app, and then select the Application Settings tab.
IIS5 Compatibility Mode
IIS5 Compatibility Mode is not supported. In Azure App Service, each web app and all of the applications under
it run in the same worker process with a specific set of application pools.
IIS7+ schema compliance
Some elements and attributes are not defined in the Azure App Service IIS schema. If you encounter issues,
consider using XDT transforms.
Single application pool per site
In Azure App Service, each web app and all of the applications under it run in the same application pool.
Consider establishing a single application pool with common settings or creating a separate web app for each
application.
COM and COM+ components
Azure App Service does not allow the registration of COM components on the platform. If your app makes use
of any COM components, these need to be rewritten in managed code and deployed with the site or application.
Physical directories
Azure App Service does not allow physical drive access. You may need to use Azure Files to access files via SMB.
Azure Blob Storage can store files for access via HTTPS.
ISAPI filters
Azure App Service can support the use of ISAPI Filters, however, the ISAPI DLL must be deployed with your site
and registered via web.config.
HTTPS bindings and SSL
HTTPS bindings are not migrated, nor are the SSL certificates associated with your web sites. SSL certificates can
be manually uploaded after site migration is completed, however.
SharePoint and FrontPage
SharePoint and FrontPage Server Extensions (FPSE) are not supported.
Web site size
Free sites have a size limit of 1 GB of content. If your site is greater than 1 GB, you must upgrade to a paid SKU.
See App Service pricing.
Database size
For SQL Server databases, please check the current SQL Database pricing.
Azure Active Directory (AAD) integration
AAD does not work with free apps. To use AAD, you must upgrade the app SKU. See App Service pricing.
Monitoring and diagnostics
Your current on-premises solutions for monitoring and diagnostics are unlikely to work in the cloud. However,
Azure provides tools for logging, monitoring, and diagnostics so that you can identify and debug issues with
web apps. You can easily enable diagnostics for your web app in its configuration, and you can view the logs
recorded in Azure Application Insights. Learn more about enabling diagnostics logging for web apps.
Connection strings and application settings
Consider using Azure KeyVault, a service that securely stores sensitive information used in your application.
Alternatively, you can store this data as an App Service setting.
DNS
You may need to update DNS configurations based on the requirements of your application. These DNS settings
can be configured in the App Service custom domain settings.
See also
How to determine if your app qualifies for App Service
Moving your database to the cloud
Azure web app sandbox details and restrictions
Migrate an ASP.NET Web application to an Azure
Virtual Machine
3/6/2021 • 2 minutes to read • Edit Online
This document provides an overview of how to migrate an ASP.NET web application from on-premises to an
Azure Virtual Machine.
Quickstart
Learn how to create a virtual machine and publish your app to it: Publish to an Azure VM
Get Started
These tutorials demonstrate the steps to create (or migrate) a virtual machine, publish your web application to it,
and other tasks that may be required to support your application in Azure.
Create a virtual machine for your ASP.NET application in Azure using one of the following options:
Create a new virtual machine for ASP.NET Applications
Migrate an existing on-premises VMWare virtual machine
Migrate an existing on-premises Hyper-V virtual machine
Publish your app using Visual Studio
Create a secure virtual network for your VMs
Create a CI/CD pipeline for your application
Move to a VM scale set for high availability and scalability
Considerations
Benefits
Virtual machines offer the easiest path to migrate an application from on-premises to the cloud. They enable
you to replicate the same environment your application uses on-premises, while removing the need to maintain
your own data centers. Virtual Machine Scale Sets provide high availability and scalability for applications
running in Virtual Machines.
Virtual Machine Size
Choose the virtual machine size and type that is best optimized for your workload. For more information, see
Sizes for Windows virtual machines in Azure.
Maintenance
Just like an on-premises machine, you are responsible for maintaining and updating the virtual machine*. If your
application can run in a Platform as a Service (PaaS) environment such as Azure App Service or in a container,
that will remove this need.
*Automatic OS upgrades for virtual machine scale sets is currently available as a Preview service.
Virtual Networks
Azure Virtual Networks enable you to:
Build a hybrid infrastructure that you control
Bring your own IP addresses and DNS servers
Create an isolated and highly secure environment for your applications
Connect your VM to your on-premises network using one of several connectivity options
Integrate your virtual machine into your on-premises network using ExpressRoute
To get started, see the Virtual Network documentation
Active Directory
Many applications use Active Directory for authentication and identity management.
Azure AD Connect enables you to integrate your on-premises directories with Azure Active Directory. To get
started, see Integrate your on-premises directories with Azure Active Directory.
Alternatively, ExpressRoute enables your application to access your on-premises Active Directory.
SQL Databases
If your application is using an on-premises database, your app will not be able to talk to it by default. You can
either:
Configure a hybrid network that enables your application to access your database running on-premises.
Migrate your database to the Azure. For more information, see Migrate your SQL Server database to Azure.
High Availability and Scalability
Virtual Machine Scale Sets
You want to make sure that your application is highly available and can scale, migrate your VM image to an
Azure Virtual Machine Scale Set to improve the availability and scalability of your application. VM Scale Sets
provide the ability to use an existing VM you've already configured or set up a build pipeline to build an image
with your application.
To get started, see Deploy your application on virtual machine scale sets.
Centralized Logging
When running your application across multiple instances, consider storing your logs in a centralized location
such as Azure Storage.
Next steps
Migrate a SQL Server database to Azure
Migrate a SQL Server database to Azure
11/2/2020 • 3 minutes to read • Edit Online
This article provides a brief outline of two options for migrating a SQL Server database to Azure. Azure has
three primary options for migrating a production SQL Server database. This article focuses on the following two
options:
1. SQL Server on Azure VMs: A SQL Server instance installed and hosted on a Windows Virtual Machine
running in Azure, also known as Infrastructure as a Service (IaaS).
2. Azure SQL Database: A fully managed SQL database Azure service, also known as Platform as a Service
(PaaS).
Both come with pros and cons that you will need to evaluate before migrating. The third option is Azure SQL
Database managed instances.
Get started
The following migration guides will be useful, depending on which service you use:
Migrate a SQL Server database to SQL Server in an Azure VM
Migrate your SQL Server database to Azure SQL Database
Additionally, the following links to conceptual content will help you understand VMs better:
High availability and disaster recovery for SQL Server in Azure Virtual Machines
Performance best practices for SQL Server in Azure Virtual Machines
Application Patterns and Development Strategies for SQL Server in Azure Virtual Machines
And the following links will help you understand Azure SQL Database better:
Create and manage Azure SQL Database servers and databases
Database Transaction Units (DTUs) and elastic Database Transaction Units (eDTUs)
Azure SQL Database resource limits
Migration Requires minimal changes to your May require changes to your database
database. if you use features unavailable in Azure
SQL, as determined by the Data
Migration Assistant, or if you have
other dependencies such as locally
installed executables.
Managing availability, recovery, and Availability and recovery are Automatically managed for you.
upgrades configured manually. Upgrades can be
automated with VM Scale Sets.
Managing database size Supports up to 256 TB of storage per Supports 8 TB of storage before
SQL Server instance. needing a horizontal partition.
Managing costs You must manage SQL Server license You must manage service costs (based
costs, Windows Server license costs, on eDTUs or DTUs, storage, and
and VM costs (based on cores, RAM, number of databases if using an elastic
and storage). pool). You must also manage the cost
of any SLA.
To learn more about the differences between the two, see Choose the right deployment option in Azure SQL.
FAQ
Can I still use tools such as SQL Ser ver Management Studio and SQL Ser ver Repor ting
Ser vices (SSRS) with SQL Ser ver in Azure VMs or Azure SQL Database?
Yes. All Microsoft SQL tooling works with both services. SSRS is not part of Azure SQL Database, though,
and it's recommended that you run it in an Azure VM and then point it to your database instance.
I want to go PaaS but I'm not sure if my database is compatible. Are there tools to help?
Yes. The Data Migration Assistant is a tool that is used as a part of migrating to Azure SQL Database. The
Azure Database Migration Service is a preview service that you can use for either IaaS or PaaS.
Can I estimate costs?
Yes. The Azure Pricing Calculator can be used for estimating costs for all Azure services, including VMs
and database services.
Next steps
Choose the right Azure hosting option
Azure SDK for .NET overview
3/6/2021 • 2 minutes to read • Edit Online
Recommended: Azure.Identity
The latest packages in the Azure SDK for .NET use a common authentication package to authenticate,
Azure.Identity . Using Azure.Identity is recommended over other authentication mechanisms described later
in this document. Packages supporting the credentials provided by Azure.Identity are built on top of
Azure.Core and have package identifiers starting with Azure. See the package list for an inventory of packages
that use Azure.Core .
For complete instructions on using Azure.Identity in your project, see the documentation for Azure Identity
client for .NET.
TIP
See the Azure Identity, Resource Management, and Storage sample for examples of using Azure Identity to manage and
access Azure resources.
To authenticate with libraries that don't support Azure.Identity, see the rest of this topic.
az account show
If you're not logged into the correct subscription, select the correct one by typing
az account set -s <name or ID of subscription> .
az ad sp create-for-rbac --sdk-auth
{
"clientId": "b52dd125-9272-4b21-9862-0be667bdf6dc",
"clientSecret": "ebc6e170-72b2-4b6f-9de2-99410964d2d0",
"subscriptionId": "ffa52f27-be12-4cad-b1ea-c2c241b6cceb",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
"resourceManagerEndpointUrl": "https://management.azure.com/",
"activeDirectoryGraphResourceId": "https://graph.windows.net/",
"sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
"galleryEndpointUrl": "https://gallery.azure.com/",
"managementEndpointUrl": "https://management.core.windows.net/"
}
Copy and paste the JSON output to a text editor for use later.
Now that the service principal is created, two options are available to authenticate to the service principal to
create and manage resources.
For both options you will need to add the following NuGet packages to your project.
Install-Package Microsoft.Azure.Management.Fluent
Install-Package Microsoft.Azure.Management.ResourceManager.Fluent
Use the clientId, clientSecret, and tenantId values from the JSON output when you created the service principal.
Then create the entry point Azure object to start working with the API:
It is recommended that you explicitly provide the subscriptionId from the JSON output to the Azure object:
Read the contents of the file and create the entry point Azure object to start working with the API:
// pull in the location of the authentication properties file from the environment
var credentials = SdkContext.AzureCredentialsFactory
.FromFile(Environment.GetEnvironmentVariable("AZURE_AUTH_LOCATION"));
The Azure SDK for .NET client libraries includes the ability to log client library operations. This allows you to
monitor I/O requests and responses that client libraries are making to Azure services. Typically, the logs are used
to debug or diagnose communication issues. This article describes three approaches to enable logging with the
Azure SDK for .NET:
Log to the console window
Log to .NET diagnostics traces
Configure custom logging
IMPORTANT
This article applies to client libraries that use the most recent versions of the Azure SDK for .NET. To see if a library is
supported, refer to the list of Azure SDK latest releases. If your application is using an older version of the Azure SDK
client libraries, refer to specific instructions in the applicable service documentation.
Log information
The SDK logs the following information, sanitizing parameter query and header values to remove personal data.
HTTP request log entry:
Unique ID
HTTP method
URI
Outgoing request headers
HTTP response log entry:
Duration of I/O operation (time elapsed)
Request ID
HTTP status code
HTTP reason phrase
Response headers
Error information, when applicable
For request and response content:
Content stream as text or bytes depending on the Content-Type header.
Next steps
Enable diagnostics logging for apps in Azure App Service
Review Azure security logging and auditing options
Learn how to work with Azure platform logs
Read more about .NET Core logging and tracing
Configure a proxy server when using the Azure SDK
for .NET
3/6/2021 • 2 minutes to read • Edit Online
If your organization requires the use of a proxy server to access internet resources, you will need to set an
environment variable with the proxy server information to use the Azure SDK for .NET.
All libraries
NAME PA C K A GE DO C S SO URC E