Forum Discussion
Balanjaneyulu_Kantu
Jan 22, 2024Copper Contributor
Retrieve Active Directory Organization Units with Microsoft Graph APi
How can I retrieve the Active Directory organization units(OU) that have been synced to Azure using ADDS(Active Directory Domain Services)? According to: https://azure.microsoft.com/en-us/documen...
ItsBhatti
Jan 22, 2024Iron Contributor
To retrieve Active Directory Organization Units (OUs) using Microsoft Graph API, you can use the Microsoft Graph API's beta version. Note that using beta features means they are subject to change and not recommended for production use. Ensure that you have the necessary permissions and follow the authentication process for your application.
Here's a general outline of the steps:
Register Your Application:
- Go to the Azure Portal.
- Navigate to Azure Active Directory > App registrations.
- Register a new application and note down the Application (client) ID and Directory (tenant) ID.
Assign Permissions:
- In the Azure portal, navigate to your registered application, and go to the "API permissions" section.
- Add the required permissions. For reading OUs, you may need to add the "Directory.Read.All" permission.
Acquire an Access Token:
- Use the OAuth 2.0 authorization code flow or another suitable authentication flow to acquire an access token for your applicationhttps://happyphone.se/
Make a Request to Microsoft Graph API:
- Use the acquired access token to make a request to the Microsoft Graph API.