Unsure how to build user list in Azure AD like I did with on prem AD

stelees 1 Reputation point
2022-09-14T23:03:50.027+00:00

Hi there,
At my previous employment I built a script in Powershell that would go through certain OU, pull out user information, create a custom PS object that bound the user information with some other ID that were read into the script also to form a larger file that was then use to update data in a different system. Basically it pulled in based on email an ID for a user from system A, bound that to AD data from on prem AD then via an API call outbound updated system C with user information based on the ID.

Where I am now has a similar issue where they are doing a heap of manual exports from two systems to create a CSV to import into a third system. I know I could leverage the same process but I am not sure how to translate the previous calls to AD on prem I used into how to pull data from Azure AD.

    $staff = foreach ($OU in $staff_ous) {  
        get-aduser -Filter $filter -SearchBase $OU -Properties $properties  
    }  

Is there a go to tutorial or process that anyone is familiar with that may assist me on this journey to try and figure out how to do this. I think I am going to come up with a tonne of permission issues and blockers with needing to pull information from Azure AD but I need to start this one somewhere.

Really appreciate the assistance, thanks.

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,452 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,434 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rafael da Rocha 5,166 Reputation points
    2022-09-15T02:47:37.42+00:00

    OUs aren't a thing in Azure AD, so you'll have to look at something else to filter your query.
    Maybe a property like department, or use AAD Groups.

    Other than that, you'll want to use cmdlets from AzureAD PowerShell module or even better, Microsoft Graph PowerShell to get the information from Azure.

    The logic in PowerShell is the same, just the cmdlets will be a little different, and some functionality that you relied on for on prem scripts might not be available in AAD.

    0 comments No comments

  2. stelees 1 Reputation point
    2022-09-15T03:13:01.673+00:00

    Thanks for that, yeh sorry I missed a line where I should have said, this is the sort of thing I was doing for on prem :)

    Thanks for the links, I will go hunting.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.