简体   繁体   中英

I'd like to create a program that returns basic AzureAD information without tying it to one tenant

I'm not a C# programmer so forgive the ignorance, but I'm trying to create a program that will use the Graph API to do simple AzureAD commands, such as listing users, groups, etc. All articles that I've read on how to do this says the app first needs to be registered within AzureAD in order to do this, but I'd like this program to not be tied to that tenant. It'd prefer to just have a user authenticate to their tenant and use that access token to access Azure instead. I'd love any resources or where to begin. I tried to follow this article https://www.c-sharpcorner.com/article/write-your-first-program-using-microsoft-graph-sdk/ but it didn't work.

The correct approach is to register the app in your tenant as a multi-tenant app.

https://docs.microsoft.com/en-us/azure/active-directory/develop/single-and-multi-tenant-apps

This will allow the users to login with their tenant. Your app can define the permissions it requires, which the other tenant users must consent to.

If you want to know Azure AD information, the tenant must be provided.

You can get the tenants for your account by calling

GET https://management.azure.com/tenants?api-version=2019-06-01

Reference:

https://docs.microsoft.com/en-us/rest/api/resources/tenants/list

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM