We want to find the directory details in which user is a member. In Portal, these are found in Directories + Subscriptions
tab.
How to get the same details using Azure API?
We found this API but getting only one organisation
GET https://graph.microsoft.com/v1.0/organization
Is there a way for all organization’s details in one API call? Thanks, Damodhar
2
Answers
there isn’t a single API call that provides details for all organizations in a tenant.Microsoft Graph APi provides the organiztion endpoint, but it returns information about the organization to which the authenticated user belongs, so if you want information about the directories in which a user is a member, you might need to use the /me/memberOf endpoint to get the list of groups, directory roles, and administrative.
If you need more info on Microsoft graph API
https://learn.microsoft.com/en-us/search/?terms=Microsoft%20Graph%20API%20&category=QnA
I registered one Azure AD application and granted below API permission in it:
Now, I generated access token using username password flow via Postman with below parameters:
Response:
When I ran below Azure Management API call with generated token, I got list of organizations successfully as below:
Response:
Reference:
Tenants – List – REST API (Azure Resource Management) | Microsoft