使用 Get-AzureAdUser 有没有办法从源“Windows 服务器广告”中拉回所有用户?

Sea*_*nox 4 azure azure-powershell azure-active-directory

我有一个包含大约 20 万用户的目录。我需要撤回来自本地 AD 的所有用户。这当然会排除多个源来宾用户。我必须使用源,因为并非所有用户都有用户类型。

如果有一种方法可以搜索 Department 不等于 null 也可以,但它似乎不是 odata 过滤器标准的一部分。

Get-AzureADUser -Filter "Department eq ''"  | select DisplayName,`
    UserPrincipalName,Mail,creationType,AccountEnabled,Department
Run Code Online (Sandbox Code Playgroud)

Roh*_*gal 5

要获取来自本地 AD 的用户,您可以执行以下操作

 Get-AzureADUser -Filter "dirSyncEnabled eq true"
Run Code Online (Sandbox Code Playgroud)

如果仅选择少数,也可以使用其他运算符(例如 top)。例如

 Get-AzureADUser -top 5 -Filter "dirSyncEnabled eq true"
Run Code Online (Sandbox Code Playgroud)

为了让所有用户都可以做一次

Get-AzureADUser -All $true -Filter "dirSyncEnabled eq true"
Run Code Online (Sandbox Code Playgroud)

或者

Get-AzureADUser -all $true | where-object -property DirSyncEnabled -eq "True"
Run Code Online (Sandbox Code Playgroud)