Authenticate to Azure Using Azure SDK for .NET and Armclient

This Azure SDK for .NET post will show how to connect and authenticate to Azure using the Armclient.

Armclient

The Armclient is a .NET class part of the Azure Resource Manager library and allows us to manage (list, create, update and list) resources on Microsoft Azure.

We need to follow the following steps to connect to Azure using the Armclient.

Step 1: Create App Registration

As shown on this blog many times, You must create an App Registration with enough permissions to Azure. Once you create an App Registration, copy the following details from it:

  • Azure Tenant ID
  • Azure Client ID
  • Azure Client Secret

Step 2: Install Library

Create a .NET application and install the following package.

Step 3: Create Environment Variables

Using the values from the App Registration step (2) create the following 3 environment variables.

Step 4: Use the Armclient

Finally, use the following code (C#) in your .NET application to connect to Azure and list the ID of the default Azure subscription.

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.