Home

Get a report of all cloud accounts

%3CLINGO-SUB%20id%3D%22lingo-sub-122674%22%20slang%3D%22en-US%22%3EGet%20a%20report%20of%20all%20cloud%20accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-122674%22%20slang%3D%22en-US%22%3E%3CP%3EI%20need%20to%20get%20a%20list%20of%20all%20cloud%20only%20accounts%20(onmicrosoft.com).%26nbsp%3B%20I%20can%20see%20in%20Azure%20AD%20User%20Reports%20the%20Source%20field%20will%20help%20narrow%20this%20down%20for%20me%20as%20we%20sync%20our%20on-prem%20AD%20to%20the%20cloud%2C%20so%20those%20have%20a%20Source%20of%20'Windows%20Server%20AD'%20and%20the%20cloud%20accounts%20have%20a%20Source%20of%20'Azure%20Active%20Directory'.%26nbsp%3B%20However%20it%20doesn't%20appear%20you%20can%20do%20any%20filtering%20within%20the%20user%20report.%26nbsp%3B%20Is%20there%20a%20PowerShell%20command%20I%20could%20run%20that%20would%20give%20me%20a%20list%20of%20all%20users%20with%20a%20source%20of%20Azure%20Active%20Directory%3F%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-122674%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EIdentity%20Management%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-184349%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20a%20report%20of%20all%20cloud%20accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-184349%22%20slang%3D%22en-US%22%3E%3CP%3ENo%20worries%2C%20one%20less%20mystery%20%3A)%3C%2Fimg%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-184197%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20a%20report%20of%20all%20cloud%20accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-184197%22%20slang%3D%22en-US%22%3E%3CP%3EThat%20was%20the%20issue.%20I%20had%20previously%20run%20the%20install-module%20command%20which%20replaced%20the%20version%20I%20had%20installed.%20I%20assumed%20it%20updated%20to%20the%20latest%20version%20but%20that%20was%20not%20the%20case.%20Nothing%20I%20did%20worked%20until%20I%20removed%20the%20AzureAD%20module%20completely.%20Thank%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-184035%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20a%20report%20of%20all%20cloud%20accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-184035%22%20slang%3D%22en-US%22%3E%3CP%3EThat's%20still%20a%20very%20old%20one%2C%20released%20year%20and%20a%20half%20ago.%20Get%20the%20latest%20one%2C%202.0.1.6%3A%20%3CA%20href%3D%22https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FAzureAD%2F2.0.1.6%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FAzureAD%2F2.0.1.6%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-183884%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20a%20report%20of%20all%20cloud%20accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-183884%22%20slang%3D%22en-US%22%3E%3CP%3EI%20updated%20it%20in%20the%20process%20of%20trying%20to%20figure%20this%20out.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CPRE%3E%3CBR%20%2F%3EPS%20C%3A%5CWindows%5Csystem32%26gt%3B%20Get-Module%20-Name%20AzureAD%3CBR%20%2F%3E%3CBR%20%2F%3EModuleType%20Version%20Name%20ExportedCommands%3CBR%20%2F%3E----------%20-------%20----%20----------------%3CBR%20%2F%3EBinary%202.0.0.33%20AzureAD%20%7BAdd-AzureADApplicationOwner%2C%20Add-AzureADDeviceRegisteredOwner%2C%20Add-AzureADDeviceRegisteredUser%2C%20A...%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-183859%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20a%20report%20of%20all%20cloud%20accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-183859%22%20slang%3D%22en-US%22%3E%3CP%3EWhat%20version%20of%20the%20AzureAD%20module%20is%20that%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-183846%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20a%20report%20of%20all%20cloud%20accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-183846%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%20I%20read%20that%20was%20the%20case%2C%20but%20it%20does%20not%20work.%20This%20is%20the%20result%20I%20get%20from%20that%20command.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EPS%20C%3A%5CWindows%5Csystem32%26gt%3B%20Get-AzureADUser%20-All%20%24True%3CBR%20%2F%3EGet-AzureADUser%20%3A%20A%20parameter%20cannot%20be%20found%20that%20matches%20parameter%20name%20'All'.%3CBR%20%2F%3EAt%20line%3A1%20char%3A17%3CBR%20%2F%3E%2B%20Get-AzureADUser%20-All%20%24True%3CBR%20%2F%3E%2B%20~~~~%3CBR%20%2F%3E%20%2B%20CategoryInfo%20%3A%20InvalidArgument%3A%20(%3A)%20%5BGet-AzureADUser%5D%2C%20ParameterBindingException%3CBR%20%2F%3E%20%2B%20FullyQualifiedErrorId%20%3A%20NamedParameterNotFound%2CMicrosoft.Open.AzureAD16.PowerShell.GetUser%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-183803%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20a%20report%20of%20all%20cloud%20accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-183803%22%20slang%3D%22en-US%22%3E%3CP%3E%22All%22%20is%20a%20Boolean%20parameter%2C%20so%20you%20have%20to%20use%20it%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGet-AzureADUser%20-All%20%24true%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20know%2C%20stupid%2C%20just%20add%20it%20to%20the%20list%20of%20inconveniences%26nbsp%3Bfor%20the%20module...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-183764%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20a%20report%20of%20all%20cloud%20accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-183764%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20trouble%20I'm%20having%20with%20this%20command%20is%20that%20it%20does%20not%20return%20all%20objects.%20While%20the%20documentation%20states%20that%20there%20is%20an%20-All%20flag%20that%20should%20achieve%20this%2C(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fazuread%2Fget-azureaduser%3Fview%3Dazureadps-2.0%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fazuread%2Fget-azureaduser%3Fview%3Dazureadps-2.0%3C%2FA%3E)%20it%20does%20not%20appear%20to%20work.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERunning%20Get-Help%20Get-AzureADUser%20does%20not%20show%20the%20-All%20flag.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EPS%20C%3A%5CWindows%5Csystem32%26gt%3B%20Get-Help%20Get-AzureADUser%3CBR%20%2F%3ENAME%3CBR%20%2F%3E%20Get-AzureADUser%3CBR%20%2F%3ESYNOPSIS%3CBR%20%2F%3E%20Retrieves%20a%20specific%20user%20from%20Azure%20Active%20Directory%3CBR%20%2F%3ESYNTAX%3CBR%20%2F%3E%20Get-AzureADUser%20%5B-Top%20%3CNULLABLE%3E%5D%20%5B-Filter%20%3CSTRING%3E%5D%20%5B%3CCOMMONPARAMETERS%3E%5D%3CBR%20%2F%3E%20Get-AzureADUser%20%5B-SearchString%20%3CSTRING%3E%5D%20%5B%3CCOMMONPARAMETERS%3E%5D%3CBR%20%2F%3E%20Get-AzureADUser%20-ObjectId%20%3CSTRING%3E%20%5B%3CCOMMONPARAMETERS%3E%5D%3CBR%20%2F%3EDESCRIPTION%3CBR%20%2F%3ERELATED%20LINKS%3CBR%20%2F%3EREMARKS%3CBR%20%2F%3E%20To%20see%20the%20examples%2C%20type%3A%20%22get-help%20Get-AzureADUser%20-examples%22.%3CBR%20%2F%3E%20For%20more%20information%2C%20type%3A%20%22get-help%20Get-AzureADUser%20-detailed%22.%3CBR%20%2F%3E%20For%20technical%20information%2C%20type%3A%20%22get-help%20Get-AzureADUser%20-full%22.%3CBR%20%2F%3E%20For%20online%20help%2C%20type%3A%20%22get-help%20Get-AzureADUser%20-online%22%3C%2FCOMMONPARAMETERS%3E%3C%2FSTRING%3E%3C%2FCOMMONPARAMETERS%3E%3C%2FSTRING%3E%3C%2FCOMMONPARAMETERS%3E%3C%2FSTRING%3E%3C%2FNULLABLE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-123753%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20a%20report%20of%20all%20cloud%20accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-123753%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20you're%20using%20the%20newer%20AzureAD%20module%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EGet-AzureADUser%20%7C%20Where%20%7B%24_.DirSyncEnabled%20-ne%20%24true%7D%3C%2FPRE%3E%3CP%3EInterestingly%2C%20the%20values%20appear%20to%20be%20either%20%22True%22%20or%20%22null%22%2C%20not%20%22False.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EPS%20C%3A%5C%26gt%3B%20Get-AzureADUser%20%7C%20Group-Object%20-Property%3ADirSyncEnabled%0A%0ACount%20Name%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Group%0A-----%20----%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-----%0A%20%20%2098%20True%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Bclass%20User%20%7B...%0A%20%20%20%202%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Bclass%20User%20%7B...%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-122816%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20a%20report%20of%20all%20cloud%20accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-122816%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20can%20use%20something%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%20Get-MsolUser%20%7C%20%3F%20%7B-not%20%24_.LastDirSyncTime%7D%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Erin Scupham
Regular Contributor

I need to get a list of all cloud only accounts (onmicrosoft.com).  I can see in Azure AD User Reports the Source field will help narrow this down for me as we sync our on-prem AD to the cloud, so those have a Source of 'Windows Server AD' and the cloud accounts have a Source of 'Azure Active Directory'.  However it doesn't appear you can do any filtering within the user report.  Is there a PowerShell command I could run that would give me a list of all users with a source of Azure Active Directory?  

10 Replies

You can use something like this:

 

 Get-MsolUser | ? {-not $_.LastDirSyncTime}

If you're using the newer AzureAD module:

 

Get-AzureADUser | Where {$_.DirSyncEnabled -ne $true}

Interestingly, the values appear to be either "True" or "null", not "False.

 

PS C:\> Get-AzureADUser | Group-Object -Property:DirSyncEnabled

Count Name                      Group
----- ----                      -----
   98 True                      {class User {...
    2                           {class User {...

The trouble I'm having with this command is that it does not return all objects. While the documentation states that there is an -All flag that should achieve this,(https://docs.microsoft.com/en-us/powershell/module/azuread/get-azureaduser?view=azureadps-2.0) it does not appear to work.

 

Running Get-Help Get-AzureADUser does not show the -All flag.

 

PS C:\Windows\system32> Get-Help Get-AzureADUser
NAME
Get-AzureADUser
SYNOPSIS
Retrieves a specific user from Azure Active Directory
SYNTAX
Get-AzureADUser [-Top <Nullable`1[Int32]>] [-Filter <String>] [<CommonParameters>]
Get-AzureADUser [-SearchString <String>] [<CommonParameters>]
Get-AzureADUser -ObjectId <String> [<CommonParameters>]
DESCRIPTION
RELATED LINKS
REMARKS
To see the examples, type: "get-help Get-AzureADUser -examples".
For more information, type: "get-help Get-AzureADUser -detailed".
For technical information, type: "get-help Get-AzureADUser -full".
For online help, type: "get-help Get-AzureADUser -online"

 

"All" is a Boolean parameter, so you have to use it like this:

 

Get-AzureADUser -All $true

 

I know, stupid, just add it to the list of inconveniences for the module...

Yes, I read that was the case, but it does not work. This is the result I get from that command.

 

PS C:\Windows\system32> Get-AzureADUser -All $True
Get-AzureADUser : A parameter cannot be found that matches parameter name 'All'.
At line:1 char:17
+ Get-AzureADUser -All $True
+ ~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AzureADUser], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Open.AzureAD16.PowerShell.GetUser

 

What version of the AzureAD module is that?

I updated it in the process of trying to figure this out.


PS C:\Windows\system32> Get-Module -Name AzureAD

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 2.0.0.33 AzureAD {Add-AzureADApplicationOwner, Add-AzureADDeviceRegisteredOwner, Add-AzureADDeviceRegisteredUser, A...

That's still a very old one, released year and a half ago. Get the latest one, 2.0.1.6: https://www.powershellgallery.com/packages/AzureAD/2.0.1.6

That was the issue. I had previously run the install-module command which replaced the version I had installed. I assumed it updated to the latest version but that was not the case. Nothing I did worked until I removed the AzureAD module completely. Thank you.

No worries, one less mystery :) 

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
35 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies