Report AAD Users together with their Registered Device

%3CLINGO-SUB%20id%3D%22lingo-sub-650302%22%20slang%3D%22en-US%22%3EReport%20AAD%20Users%20together%20with%20their%20Registered%20Device%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-650302%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Guys%3C%2FP%3E%3CP%3ENeed%20assistance%20to%20get%20a%20report%20of%20Azure%20AD%20users%20together%20with%20their%20registered%20device%20name%2C%20I%60m%20trying%20the%20following%20command%20but%20I%60m%20not%20getting%20the%20correct%20results%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EForeach%20User%20in%20%E2%80%9C%3CSPAN%3EGet-ADUser%20-All%E2%80%9D%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20UserCreds%20%3D%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EGet-AzureADUserRegisteredDevice%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B-ObjectId%20%24User%3C%2FSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-650613%22%20slang%3D%22en-US%22%3ERe%3A%20Report%20AAD%20Users%20together%20with%20their%20Registered%20Device%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-650613%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20has%20been%20answered%20several%20times%20already%2C%20do%20a%20search%20next%20time%20%3A)%3C%2Fimg%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3EGet-AzureADUser%20%7C%20%25%20%7B%24DeviceOwner%20%3D%20%24_.UserPrincipalName%3B%20Get-AzureADUserRegisteredDevice%20-ObjectId%20%24_.ObjectId%20%7D%20%7C%20select%20%40%7Bn%3D%22DeviceOwner%22%3Be%3D%7B%24DeviceOwner%7D%7D%2CDisplayName%2CDeviceOSType%2CApproximateLastLogonTimeStamp%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-651215%22%20slang%3D%22en-US%22%3ERe%3A%20Report%20AAD%20Users%20together%20with%20their%20Registered%20Device%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-651215%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev%3C%2FA%3E%26nbsp%3Bthanks%20for%20the%20script%20and%20I%20did%20try%20it%20but%20it%20doesn%60t%20bring%20the%20results%2C%20please%20see%20attached%20screenshot.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-652630%22%20slang%3D%22en-US%22%3ERe%3A%20Report%20AAD%20Users%20together%20with%20their%20Registered%20Device%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-652630%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETry%20using%20an%20account%20that%20has%20sufficient%20permissions%20to%20enumerate%20users%20in%20the%20directory%20as%20well%20as%20call%20the%26nbsp%3B%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EGet-AzureADUserRegisteredDevice%3C%2FFONT%3E%20cmdlet.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-652921%22%20slang%3D%22en-US%22%3ERe%3A%20Report%20AAD%20Users%20together%20with%20their%20Registered%20Device%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-652921%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F349494%22%20target%3D%22_blank%22%3E%40Simphiwe_Mkhize01%3C%2FA%3E%26nbsp%3B%20Hello!%20You've%20posted%20your%20question%20in%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FCommunity-Discussion%2Fbd-p%2FCommunityQuestions%22%20target%3D%22_blank%22%3ECommunity%20Discussion%20space%3C%2FA%3E%2C%20which%20is%20intended%20for%20discussion%20around%20the%20Tech%20Community%20website%20itself%2C%20not%20product%20questions.%20I'm%20moving%20your%20question%20to%20the%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FAzure-Active-Directory%2Fbd-p%2FAzure-Active-Directory%22%20target%3D%22_self%22%3EAzure%20Active%20Directory%20space%3C%2FA%3E%20-%26nbsp%3Bplease%20post%20Azure%20Active%20Directory%20questions%20here%20in%20the%20future.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-653020%22%20slang%3D%22en-US%22%3ERe%3A%20Report%20AAD%20Users%20together%20with%20their%20Registered%20Device%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-653020%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F41707%22%20target%3D%22_blank%22%3E%40Eric%20Starker%3C%2FA%3E%26nbsp%3Bthank%20you%20for%20your%20assistance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-653025%22%20slang%3D%22en-US%22%3ERe%3A%20Report%20AAD%20Users%20together%20with%20their%20Registered%20Device%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-653025%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev%3C%2FA%3E%26nbsp%3Bwill%20try%20that%20and%20give%20feedback.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1132860%22%20slang%3D%22en-US%22%3ERe%3A%20Report%20AAD%20Users%20together%20with%20their%20Registered%20Device%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1132860%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev%3C%2FA%3E%26nbsp%3BThis%20returns%20value%20with%20single%20user.%20Please%20suggest%20query%20with%20same%20results%20for%20all%20users.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1134451%22%20slang%3D%22en-US%22%3ERe%3A%20Report%20AAD%20Users%20together%20with%20their%20Registered%20Device%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1134451%22%20slang%3D%22en-US%22%3EYou%20should%20do%20'Get-AzureADUser%20-all%20%24true'%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1145446%22%20slang%3D%22en-US%22%3ERe%3A%20Report%20AAD%20Users%20together%20with%20their%20Registered%20Device%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1145446%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F349494%22%20target%3D%22_blank%22%3E%40Simphiwe_Mkhize01%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20use%20GUI%20mode%20(Azure%20Portal)%20to%20get%20the%20report%20with%20details.%3C%2FP%3E%3CP%3ELogin%20to%20Azure%20portal%26gt%3B%26gt%3B%20Devices%26gt%3B%26gt%3BAll%20Devices%3C%2FP%3E%3CP%3EHope%20this%20will%20help%20you%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1145597%22%20slang%3D%22en-US%22%3ERe%3A%20Report%20AAD%20Users%20together%20with%20their%20Registered%20Device%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1145597%22%20slang%3D%22en-US%22%3ELong%20term%20approach%3A%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20use%20Intune%20Data%20warehouse%20reporting%20to%20have%20insight%20on%20your%20environment.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fintune%2Fdeveloper%2Freports-nav-create-intune-reports%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fintune%2Fdeveloper%2Freports-nav-create-intune-reports%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EMoe%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hi Guys

Need assistance to get a report of Azure AD users together with their registered device name, I`m trying the following command but I`m not getting the correct results:

 

Foreach User in “Get-ADUser -All” {

              UserCreds = Get-AzureADUserRegisteredDevice -ObjectId $User              

}

10 Replies
Highlighted

This has been answered several times already, do a search next time :)

 

Get-AzureADUser | % {$DeviceOwner = $_.UserPrincipalName; Get-AzureADUserRegisteredDevice -ObjectId $_.ObjectId } | select @{n="DeviceOwner";e={$DeviceOwner}},DisplayName,DeviceOSType,ApproximateLastLogonTimeStamp
Highlighted

@Vasil Michev thanks for the script and I did try it but it doesn`t bring the results, please see attached screenshot. 

 

Highlighted

 

Try using an account that has sufficient permissions to enumerate users in the directory as well as call the Get-AzureADUserRegisteredDevice cmdlet.

Highlighted

@Simphiwe_Mkhize01  Hello! You've posted your question in the Community Discussion space, which is intended for discussion around the Tech Community website itself, not product questions. I'm moving your question to the Azure Active Directory space - please post Azure Active Directory questions here in the future. 

Highlighted

@Eric Starker thank you for your assistance.

Highlighted

@Vasil Michev will try that and give feedback.

Highlighted

@Vasil Michev This returns value with single user. Please suggest query with same results for all users.

Highlighted
You should do 'Get-AzureADUser -all $true'
Highlighted

Hi@Simphiwe_Mkhize01 

You can use GUI mode (Azure Portal) to get the report with details.

Login to Azure portal>> Devices>>All Devices

Hope this will help you

Highlighted
Long term approach:

You use Intune Data warehouse reporting to have insight on your environment.

https://docs.microsoft.com/en-us/intune/developer/reports-nav-create-intune-reports

Moe