在 Microsoft Entra ID 中查找用户照片属性可以帮助管理员确保配置的头像符合组织标准。验证照片属性还有助于在企业内的应用程序和服务中保持一致的用户体验。
在使用 Get-MgUserPhoto cmdlet 之前,请确保以下事项:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "User.Read.All","Group.ReadWrite.All","Directory.Read.All"
Get-MgUserPhoto cmdlet 可用于 Microsoft Graph PowerShell 中获取 Microsoft Entra ID 用户照片属性。语法如下:
Get-MgUserPhoto
-UserId <String>
[-ExpandProperty <String[]>]
[-Property <String[]>]
[-ResponseHeadersVariable <String>]
[-Headers <IDictionary>]
[-ProgressAction <ActionPreference>]
[<CommonParameters>]
列出特定用户的照片属性
Get-MgUserPhoto -UserId <"user_id">
在此命令中,将 user_id 替换为您想要列出用户照片属性的用户 ID。
下表包含一些可与 Get-MgUserPhoto 命令一起使用以获取 Microsoft Entra ID 用户照片属性的参数。
| 参数 | 描述 |
|---|---|
| -All | 此参数检索所有用户照片属性,无默认分页限制。 |
| -UserId | 此参数根据唯一标识符(如用户主体名称或对象 ID)检索用户照片属性。 |
| -Property | 此参数检索用户照片属性的特定属性。 |