验证 Microsoft Entra 混合联接

本文介绍三种查找和验证 Microsoft Entra 混合联接设备状态的方法。

先决条件

在设备上本地

按照以下步骤作:

  1. 打开 Windows PowerShell。

  2. 输入 dsregcmd /status

  3. 确保“AzureAdJoined”和“DomainJoined”均设置为“是”。

  4. 可以使用 DeviceId ,并使用 Microsoft Entra 管理中心或 PowerShell 比较服务的状态。

使用 Microsoft Entra 管理中心

按照以下步骤作:

  1. 以至少云设备管理员身份登录到 Microsoft Entra 管理中心

  2. 浏览到 Entra ID>设备>所有设备

  3. 如果“已注册”列显示“挂起”,则表示 Microsoft Entra 混合加入尚未完成。 在联合环境中,仅当无法注册和Microsoft Entra Connect 配置为同步设备时,才会发生此状态。 等待 Microsoft Entra Connect 完成同步周期。

  4. 如果“已注册”列包含日期/时间,则表示 Microsoft Entra 混合加入已完成。

使用 PowerShell

使用 Get-MgDevice 验证 Azure 租户中的设备注册状态。 此 cmdlet 位于 Microsoft Graph PowerShell SDK 中。

使用 Get-MgDevice cmdlet 检查服务详细信息时

  • 具有与 Windows 客户端上的 ID 匹配的设备 ID 的对象必须存在。
  • DeviceTrustType 的值是已加入域。 此设置相当于 Microsoft Entra 管理中心内的“设备”页上的“已进行 Microsoft Entra 混合联接”状态
  • 对于条件访问中使用的设备,Enabled 的值为 True,DeviceTrustLevel托管的。
  1. 以管理员身份打开 Windows PowerShell。

  2. 输入 Connect-MgGraph 以连接到 Azure 租户。

    统计所有已加入 Microsoft Entra 混合域的设备(不包括“挂起”状态)

    (Get-MgDevice -All | where {($_.TrustType -eq 'ServerAd') -and ($_.ProfileType -eq 'RegisteredDevice')}).count
    

    计数所有Microsoft已加入 状态的 Entra 混合联接设备

    (Get-MgDevice -All | where {($_.TrustType -eq 'ServerAd') -and ($_.ProfileType -ne 'RegisteredDevice')}).count
    

    列出所有 Microsoft Entra 混合联接设备

    Get-MgDevice -All | where {($_.TrustType -eq 'ServerAd') -and ($_.ProfileType -eq 'RegisteredDevice')}
    

    列出所有已加入 Microsoft Entra 混合域的设备(包括“挂起”状态)

    Get-MgDevice -All | where {($_.TrustType -eq 'ServerAd') -and ($_.ProfileType -ne 'RegisteredDevice')}
    

    列出单个设备的详细信息:

    1. 输入以下命令。 在本地设备上获取设备 ID。
    $Device = Get-MgDevice -DeviceId <ObjectId>
    
    1. 验证 AccountEnabled 是否设置为 True
    $Device.AccountEnabled