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.