0

I've been working on a project for a company that is trying to convert their PowerShell script for building out some infrastructure. They'd like this script converted to a form application if possible. I'm still somewhat new to Azure so there are some things that I'm confused about and am curious if anyone can either provide me an answer or point me to some resources that I can read up on. A lot of my confusion so far is how the different Azure API's play together.

For this project, AzureRM is going to be the primary API that we'd use. However in my research, GraphAPI pops up for some of the things I've been playing around with. A lot of my confusion at current comes from trying to distinguish between how to implement and if/how they should be used together.

This application would be a single tenant application for reference.

In my research, I can find a lot of ways that a person can login to their Azure account using the CLI or PowerShell. I haven't been able to find many resources that explain how this would be done programmatically in C# for something like. I have a working login which I use for GraphAPI which allows me to grab basic user information. If I needed to use something like a userID with AzureRM, can I use this userID pulled with GraphAPI or will that cause issues with AzureRM?

If I can't do the above, What is the C# equivalent to az login with something like AzureRM?

In addition to this, I've been able to find resources for getting an authToken for use with AzureRM. In this case, I'm trying to pull subscription information for the logged in account. Currently, I'm able to get an authToken through PowerShell which is how almost all of the resources I've found show how to do it. Again though, I haven't been able to find any for doing so with C#. Is there a way to get these authTokens programmatically in C#?

It is also entirely possible that I am completely misunderstanding how certain things should be done when trying to use C# with Azure. If anything above is wrong, I'd appreciate an idea of what I'd need to look at to get a correct understanding. Any links to resources that I can use to brush up on these areas to get started is appreciated.

maggierain
  • 101
  • 3
  • 1
    1/1) Your question is too broad for Stack Overflow. It is not possible to combine several years of Azure development experience into a simple answer. No matter how long the answer is, there will be important details left out. Just your question on **az login** requires solid knowledge of Azure authorization and would be a chapter in a book. There are many ways to implement az login. OAuth, service principals, managed identities, etc. Which one requires understanding the environment. – John Hanley Sep 19 '21 at 23:08
  • 2/2) I recommend reading the documentation for a section of an API, write some code, and experiment. Post a question when you have a programming-related problem that is focused and well defined. – John Hanley Sep 19 '21 at 23:08
  • To hopefully add some clarificationL Graph API is about people, calendars, Azure AD etc. You don't need it unless you want to extract that type of info. Azure Resource Manager is completely different - it's all about deploying resources to azure. Everything in the end is achieved via web API. AFAIK all other API's (Powershell, azcmd etc. ) just sit over the top of that. You might want to consider building a web app instead of a thick client app as you'll find a lot more examples. Having said that, all the C# .net web code should work whether it's web or thick client. – Nick.Mc Sep 19 '21 at 23:23
  • Appreciate the responses. That at least gives me some idea of the level of understanding I'll need to be looking to get. I'll take into consideration those suggestions for future posts and the short breakdown of the API's. – Brandon Cross Sep 20 '21 at 01:19
  • `They'd like this script converted to a form application if possible` the _pushthebutton_ forms app may be a little easier to use but it requires a lot of development comparing to scripts. However you may want to look at the [Azure REST API documentation](https://learn.microsoft.com/en-us/rest/api/azure/) just to check how it looks like. – oleksa Sep 20 '21 at 07:06
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Sep 26 '21 at 20:14

0 Answers0