Accessing Azure from C#

LJD 6 Reputation points


I've got a real newbie question re C# and Azure!

Having been coding in Visual Basic for many years, I've finally learned C#, and have also completed Microsoft's online Azure training. The training has all been very straight forward, but I'm struggling to understand how to recreate simple CLI/PowerShell commands in C#. So for example, I've been trying to write a local C# console app which will log into Azure and simply list the Resources within a Subscription. In fact logging in has been a challenge before I even get to listing resources! I've been searching the web and have tried many different things, but nothing I've found has helped me so far

Can anybody point me to either (a) a really simple code sample to log into Azure and list resources that I can use to help my understanding; or (b) a good beginners guide that I can download or buy as a book?

Thanks in advance

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,500 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alberto Poblacion 1,556 Reputation points

    If you try to log in to Azure directly from C# without using a library then it's going to be horribly difficult. Unless you have a reason not to do so, the suggested approach is to use one of the libraries provided by Microsoft, such as Azure.Identity in the Azure SDK. See this page in the documentation.

    Here is the link to the Azure Identity client library. If you follow the links from the initial page, you will find detailed explanations and examples.

    0 comments No comments