Connect to Azure Using Azure SDK for .NET

In this Azure SDK for .NET, we will show you how to connect to Azure from a .NET application.

The Azure REST API platform allows us to connect to Azure using multiple clients, which include:

  • API Clients (Postman, etc)
  • PowerShell (Az module)
  • Azure CLI
  • .NET application (Using Azure SDK for .NET)

The Azure SDK for .NET can create and manage any aspect of Azure from within a .NET application, such as C#, ASP, Blazor, and more.

In this post, we will create a C# application that connects to Azure by utilizing the Microsoft Azure Resources management core library and creating an ArmClient class that handles the authentication layer to Azure.

Prerequisites

If you are using PowerShell, you can create them using the following commands (variables are only valid for the duration of the session and are not permanent)

Connect to Azure

To connect to Azure using the SDK, create a C# application and install the following library.

Add the following code to your Program.cs. The program will print the default Azure subscription to the screen.

Save the file and run the application using dotnet run

Processing…
Success! You're on the list.


Posted

in

,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.