Export users

Rising Flight 4,376 Reputation points
2024-08-28T20:39:39.7066667+00:00

Hi all,

We create users in on-premises Active Directory, and they are synchronized to Azure AD. I have two requirements:For every user in Azure, I see an Object ID. Is this Object ID coming from the on-premises Active Directory, or is it assigned by Azure AD?

is the below syntax correct, please correct me.

$users = Get-MgUser -All | ForEach-Object {
    $licenses = (Get-MgUserLicenseDetail -UserId $_.Id).SkuPartNumber -join "; "
    [PSCustomObject]@{
        ObjectId        = $_.Id
        UserPrincipalName = $_.UserPrincipalName
        Email           = $_.Mail
        DisplayName     = $_.DisplayName
        License         = $licenses
    }
}
$users | Export-Csv -Path "C:\temp\output.csv" -NoTypeInformation

I have an application that needs to fetch Azure AD users along with their Object IDs. I have created an Azure App Registration and given it the User.Read (delegated) Graph API permission. Is this API permission sufficient to get Azure AD users along with their Object IDs?

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,431 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,484 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,507 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,456 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,367 questions
{count} votes

Accepted answer
  1. Rich Matheisen 46,551 Reputation points
    2024-08-29T18:36:25.8133333+00:00

    ObjectID is an AAD property. The Windows Active Directory uses an ObjectGUID property. for the same purpose.

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.