使用 Microsoft Entra ID 启用无密码安全密钥登录到本地资源

本主题介绍如何为运行 Windows 10 版本 2004 或更高版本的设备启用对本地资源的无密码身份验证。 设备可以已建立 Microsoft Entra 联接或已建立 Microsoft Entra 混合联接。 在使用与 Microsoft 兼容的安全密钥或 Windows Hello 企业版云信任时,这种无密码身份验证功能提供对本地资源的无缝单一登录 (SSO)。

使用 FIDO2 密钥通过 SSO 登录到本地资源

Microsoft Entra ID 可以为一个或多个 Active Directory 域颁发 Kerberos 票证授予票证 (TGT)。 借助此功能,用户可以使用新式凭据(例如 FIDO2 安全密钥)登录 Windows,并访问传统的基于 Active Directory 的资源。 Kerberos 服务票证和授权将继续由本地 Active Directory 域控制器 (DC) 控制。

Microsoft Entra Kerberos 服务器对象在本地 Active Directory 实例中创建,然后安全地发布到 Microsoft Entra ID。 该对象不与任何物理服务器关联。 它只是 Microsoft Entra ID 用于为 Active Directory 域生成 Kerberos TGT 的一种资源。

显示如何从 Microsoft Entra ID 和 Active Directory 域服务中获取 TGT 的关系图。

  1. 用户使用 FIDO2 安全密钥登录到 Windows 10 设备,并向 Microsoft Entra ID 进行身份验证。

  2. Microsoft Entra ID 在目录中查找与用户的本地 Active Directory 域匹配的 Kerberos 服务器密钥。

    Microsoft Entra ID 为用户的本地 Active Directory 域生成 Kerberos TGT。 TGT 仅包含用户的 SID,而不包含授权数据。

  3. TGT 连同用户的 Microsoft Entra 主刷新令牌 (PRT) 一起返回给客户端。

  4. 客户端计算机与本地 Active Directory 域控制器联系,并为完全形成的 TGT 的部分 TGT 进行交易。

  5. 客户端计算机现在具有 Microsoft Entra PRT 和完整的 Active Directory TGT,并可同时访问云和本地资源。

先决条件

在开始本文中的过程之前,组织必须完成启用无密码安全密钥登录到 Windows 10 设备中的说明。

还必须满足以下系统要求:

  • 设备必须运行 Windows 10 版本 2004 或更高版本。

  • Windows Server 域控制器必须运行 Windows Server 2016 或更高版本,并为以下服务器安装修补程序:

  • 在域控制器上配置“网络安全: 配置允许用于 Kerberos 的加密类型”策略时必须启用 AES256_HMAC_SHA1。

  • 具有完成该方案中的步骤所需的凭据:

    • Active Directory 用户,属于某域的域管理组成员,以及某林的 Enterprise 管理员组成员。 称为 $domainCred。
    • Microsoft Entra 用户,属于全局管理员角色成员。 称为 $cloudCred。
  • 用户必须具有下列通过 Microsoft Entra Connect 填充的 Microsoft Entra ID 属性:

    • onPremisesSamAccountName(Entra Connect 中的 accountName)
    • onPremisesDomainName(Entra Connect 中的 domainFQDN)
    • onPremisesSecurityIdentifier(Entra Connect 中的 objectSID)

    Entra Connect 默认同步这些属性。 如果更改要同步的属性,请选择 accountName、domainFQDN 和 objectSID 进行同步。

支持的方案

本文中的方案支持在以下两个实例中使用 SSO:

  • 云资源(如 Microsoft 365)和其他启用了安全断言标记语言 (SAML) 的应用程序。
  • 本地资源,集成了 Windows 的网站身份验证。 资源可以包括需要 IIS 身份验证的网站和 SharePoint 网站和/或使用 NTLM 身份验证的资源。

不支持的方案

不支持以下方案:

  • Windows Server 加入 Active Directory 域服务 (AD DS)(仅针对本地设备)的部署。
  • 使用安全密钥的远程桌面协议 (RDP)、虚拟桌面基础结构 (VDI) 和 Citrix 方案。
  • 使用安全密钥的 S/MIME。
  • 使用安全密钥的“运行身份”。
  • 使用安全密钥登录到服务器。

安装 AzureADHybridAuthenticationManagement 模块

AzureADHybridAuthenticationManagement 模块为管理员提供 FIDO2 管理功能。

  1. 使用“以管理员身份运行”选项打开 PowerShell 提示符。

  2. 安装 AzureADHybridAuthenticationManagement 模块:

    # First, ensure TLS 1.2 for PowerShell gallery access.
    [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
    
    # Install the AzureADHybridAuthenticationManagement PowerShell module.
    Install-Module -Name AzureADHybridAuthenticationManagement -AllowClobber
    

注意

  • AzureADHybridAuthenticationManagement 模块使用 AzureADPreview PowerShell 模块提供高级 Microsoft Entra 管理功能。 如果本地计算机上已安装 Azure Active Directory PowerShell 模块,则此处所述的安装可能会因为冲突而失败。 若要避免在安装过程中出现任何冲突,请确保包含“-AllowClobber”选项标志。
  • 可以在任何可访问本地 Active Directory 域控制器的计算机上安装 AzureADHybridAuthenticationManagement 模块,而无需依赖 Microsoft Entra Connect 解决方案。
  • AzureADHybridAuthenticationManagement 模块使用 PowerShell 库分发。 PowerShell 库是 PowerShell 内容的中心存储库。 在 PowerShell 库中,可找到包含 PowerShell 命令和 Desired State Configuration (DSC) 资源的实用 PowerShell 模块。

创建 Kerberos 服务器对象

管理员使用 AzureADHybridAuthenticationManagement 模块在其本地目录中创建 Microsoft Entra Kerberos 服务器对象。

在组织中包含 Microsoft Entra 用户的每个域和林中运行以下步骤:

  1. 使用“以管理员身份运行”选项打开 PowerShell 提示符。
  2. 运行以下 PowerShell 命令以同时在本地 Active Directory 域和 Microsoft Entra 租户中创建新的 Microsoft Entra Kerberos 服务器对象。

选择 Azure 云(默认为 Azure 商业版)

默认情况下,Set-AzureADKerberosSever cmdlet 将使用商业云终结点。 如果要在另一个云环境中配置 Kerberos,则需要将 cmdlet 设置为使用指定的云。

若要获取可用云的列表并更改所需的数值,请运行以下命令:
Get-AzureADKerberosServerEndpoint

示例输出:

Current Endpoint = 0(Public)
Supported Endpoints:
   0 :Public
   1 :China
   2 :Us Government

请注意所需云环境旁边的数值

然后,若要设置所需的云环境,请运行以下命令:
(例如:美国政府云)
Set-AzureADKerberosServerEndpoint -TargetEndpoint 2

示例 1 所有凭据提示

# Specify the on-premises Active Directory domain. A new Azure AD
# Kerberos Server object will be created in this Active Directory domain.
$domain = $env:USERDNSDOMAIN

# Enter an Azure Active Directory global administrator username and password.
$cloudCred = Get-Credential -Message 'An Active Directory user who is a member of the Global Administrators group for Azure AD.'

# Enter a domain administrator username and password.
$domainCred = Get-Credential -Message 'An Active Directory user who is a member of the Domain Admins group.'

# Create the new Azure AD Kerberos Server object in Active Directory
# and then publish it to Azure Active Directory.
Set-AzureADKerberosServer -Domain $domain -CloudCredential $cloudCred -DomainCredential $domainCred

示例 2 云凭据提示

注意

如果要使用具有域管理员特权的帐户在加入域的计算机上操作,则可以跳过“-DomainCredential”参数。 如果未提供“-DomainCredential”参数,则使用当前 Windows 登录凭据访问本地 Active Directory 域控制器。

# Specify the on-premises Active Directory domain. A new Azure AD
# Kerberos Server object will be created in this Active Directory domain.
$domain = $env:USERDNSDOMAIN

# Enter an Azure Active Directory global administrator username and password.
$cloudCred = Get-Credential

# Create the new Azure AD Kerberos Server object in Active Directory
# and then publish it to Azure Active Directory.
# Use the current windows login credential to access the on-premises AD.
Set-AzureADKerberosServer -Domain $domain -CloudCredential $cloudCred

示例 3 使用新式身份验证的所有凭据提示

注意

如果组织保护基于密码的登录并强制实施现代身份验证方法(例如多重身份验证、FIDO2 或智能卡技术),则必须将 -UserPrincipalName 参数与全局管理员的用户主体名称 (UPN) 一起使用。

  • 在以下示例中,将 contoso.corp.com 替换为本地 Active Directory 域名。
  • 将以下示例中的 administrator@contoso.onmicrosoft.com 替换为全局管理员的 UPN。
# Specify the on-premises Active Directory domain. A new Azure AD
# Kerberos Server object will be created in this Active Directory domain.
$domain = $env:USERDNSDOMAIN

# Enter a UPN of an Azure Active Directory global administrator
$userPrincipalName = "administrator@contoso.onmicrosoft.com"

# Enter a domain administrator username and password.
$domainCred = Get-Credential

# Create the new Azure AD Kerberos Server object in Active Directory
# and then publish it to Azure Active Directory.
# Open an interactive sign-in prompt with given username to access the Azure AD.
Set-AzureADKerberosServer -Domain $domain -UserPrincipalName $userPrincipalName -DomainCredential $domainCred

示例 4 使用新式身份验证的云凭据提示

注意

如果使用具有域管理员权限的帐户在加入域的计算机上工作,而组织保护基于密码的登录并强制执行新式身份验证方法(例如多重身份验证、FIDO2 或智能卡技术),则必须同时使用 -UserPrincipalName 参数与全局管理员的用户主体名称 (UPN)。 可以跳过“-DomainCredential”参数。 > - 将以下示例中的 administrator@contoso.onmicrosoft.com 替换为全局管理员的 UPN。

# Specify the on-premises Active Directory domain. A new Azure AD
# Kerberos Server object will be created in this Active Directory domain.
$domain = $env:USERDNSDOMAIN

# Enter a UPN of an Azure Active Directory global administrator
$userPrincipalName = "administrator@contoso.onmicrosoft.com"

# Create the new Azure AD Kerberos Server object in Active Directory
# and then publish it to Azure Active Directory.
# Open an interactive sign-in prompt with given username to access the Azure AD.
Set-AzureADKerberosServer -Domain $domain -UserPrincipalName $userPrincipalName

查看并验证 Microsoft Entra Kerberos 服务器

可以使用以下命令查看和验证新创建的 Microsoft Entra Kerberos 服务器:

 # When prompted to provide domain credentials use the userprincipalname format for the username instead of domain\username
Get-AzureADKerberosServer -Domain $domain -UserPrincipalName $userPrincipalName -DomainCredential (get-credential)

此命令输出 Microsoft Entra Kerberos 服务器的属性。 可以查看这些属性,以验证是否所有内容都正常。

注意

通过提供“domain\username”格式的凭据来对另一个域运行,这将通过 NTLM 进行连接,然后失败。 但是,将 userprincipalname 格式用于域管理员可确保正确使用 Kerberos 尝试将 RPC 绑定到 DC。 如果用户位于 Active Directory 的受保护用户安全组中,请完成这些步骤来解决此问题:以 ADConnect 中的其他域用户身份登录,并且不提供“-domainCredential”。 使用当前登录用户的 Kerberos 票证。 执行 whoami /groups 来验证用户是否在 Active Directory 中具有执行上述命令所需的权限,以此进行确认。

属性 说明
ID AD DS DC 对象的唯一 ID。 该 ID 有时称为“槽”或​​“分支 ID” 。
DomainDnsName Active Directory 域的 DNS 域名。
ComputerAccount Microsoft Entra Kerberos 服务器对象的计算机帐户对象 (DC)。
UserAccount 已禁用的用户帐户对象,该对象可保存 Microsoft Entra Kerberos 服务器 TGT 加密密钥。 此帐户的域名为 CN=krbtgt_AzureAD,CN=Users,<Domain-DN>
KeyVersion Microsoft Entra Kerberos 服务器 TGT 加密密钥的密钥版本。 该版本是在该密钥创建时分配的。 然后,该版本会在每次轮换该密钥时都递增。 增量基于复制元数据,且有可能大于 1。 例如,初始 KeyVersion 可能为 192272 。 该密钥第一次轮换时,该版本可能会前进到 212621。 要验证本地对象的 KeyVersion 和云对象的 CloudKeyVersion 是否相同,这一点很重要 。
KeyUpdatedOn 更新或创建 Microsoft Entra Kerberos 服务器 TGT 加密密钥的日期和时间。
KeyUpdatedFrom 上次更新 Microsoft Entra Kerberos 服务器 TGT 加密密钥的 DC。
CloudId Microsoft Entra 对象的 ID。 必须与表首行中的 ID 匹配。
CloudDomainDnsName Microsoft Entra 对象的 DomainDnsName。 必须与表第二行中的 DomainDnsName 匹配。
CloudKeyVersion Microsoft Entra 对象的 KeyVersion。 必须与表第五行中的 KeyVersion 匹配。
CloudKeyUpdatedOn Microsoft Entra 对象的 KeyUpdatedOn。 必须与表第六行中的 KeyUpdatedOn 匹配。

轮换 Microsoft Entra Kerberos 服务器密钥

Azure AD Kerberos 服务器加密 krbtgt 密钥应定期轮换。 建议遵循用于轮替所有其他 Active Directory DC krbtgt 密钥的相同计划。

警告

还可以使用其他工具轮替 krbtgt 密钥, 但是,必须使用本文档中提到的工具来轮换 Microsoft Entra Kerberos 服务器的 krbtgt 密钥。 这可确保在本地 Active Directory 和 Microsoft Entra ID 中更新密钥。

Set-AzureADKerberosServer -Domain $domain -CloudCredential $cloudCred -DomainCredential $domainCred -RotateServerKey

删除 Microsoft Entra Kerberos 服务器

如果要还原方案并从本地 Active Directory 和 Microsoft Entra ID 中删除 Microsoft Entra Kerberos 服务器,请运行以下命令:

Remove-AzureADKerberosServer -Domain $domain -CloudCredential $cloudCred -DomainCredential $domainCred

多林和多域方案

Microsoft Entra Kerberos 服务器对象在 Microsoft Entra ID 中表示为 KerberosDomain 对象。 每个本地 Active Directory 域在 Microsoft Entra ID 中都表示为一个 KerberosDomain 对象。

例如,假设组织有一个 Active Directory 林,其中有两个域,分别为 contoso.comfabrikam.com。 如果选择允许 Microsoft Entra ID 为整个林颁发 Kerberos TGT,则 Microsoft Entra ID 中有两个 KerberosDomain 对象,一个 KerberosDomain 对象用于 contoso.com,另一个用于 fabrikam.com。 如果有多个 Active Directory 的林,则每个林中的每个域都有一个 KerberosDomain 对象。

在组织中每个包含 Microsoft Entra 用户的域和林中按照创建 Kerberos 服务器对象的说明进行操作。

已知行为

如果密码已过期,则会阻止通过 FIDO 登录。 用户应重置密码,然后才能使用 FIDO 登录。 此行为也适用于使用 Windows Hello 企业版云 kerberos 信任的混合本地同步用户登录。

故障排除和反馈

如果遇到问题或想要共享有关此无密码安全密钥登录功能的反馈,请执行以下操作以通过 Windows 反馈中心应用进行共享:

  1. 打开“反馈中心”并确保你已登录。
  2. 选择以下类别提交反馈:
    • 类别:安全和隐私
    • 子类别:FIDO
  3. 若要捕获日志,请使用“重新创建问题”选项。

无密码安全密钥登录常见问题解答

提示

本文中的步骤可能因开始使用的门户而略有不同。

下面是一些有关无密码登录常见问题的解答:

我的本地环境中可以采用无密码安全密钥登录吗?

此功能不适用于纯本地 AD DS 环境。

我的组织需要双重身份验证来访问资源。 为支持这一要求,我该做什么?

安全密钥分为多种形式。 请联系相关的设备制造商,讨论如何使用 PIN 或生物识别功能作为次要因素来启用设备。

管理员可以设置安全密钥吗?

我们正在致力于提供此功能的正式发布版 (GA)。

在哪里可以找到合规的安全密钥?

有关合规的安全密钥的信息,请参阅 FIDO2 安全密钥

如果丢失了安全密钥,我该怎么办?

若要删除已注册的安全密钥,请登录到 myaccount.microsoft.com,然后转到“安全信息”页

如果在创建加入 Microsoft Entra 混合的计算机后无法立即使用 FIDO 安全密钥,我该怎么办?

若正在干净安装加入 Microsoft Entra 混合的计算机,则在加入域并重新启动后,必须使用密码登录并等待策略同步,然后才能使用 FIDO 安全密钥登录。

  • 在命令提示符窗口中运行 dsregcmd /status 来检查当前状态,并检查以确保“AzureAdJoined”和“DomainJoined”状态均显示为“是”。
  • 此同步延迟是加入域的设备的已知限制,并非特定于 FIDO。

使用 FIDO 登录并收到凭据提示后无法对 NTLM 网络资源进行单一登录,我该怎么办?

请确保对足够的 DC 进行修补,以便及时响应资源服务请求。 若要查看 DC 是否正在运行此功能,请运行 nltest /dsgetdc:contoso /keylist /kdc,然后查看输出。

注意

nltest 命令中的 /keylist 开关在客户端 Windows 10 v2004 及更高版本中可用。

FIDO2 安全密钥是否适用于混合环境中存在 RODC 的 Windows 登录?

FIDO2 Windows 登录会查找可写 DC 来交换用户 TGT。 只要在每个站点至少有一个可写 DC,即可正常登录。

后续步骤

详细了解无密码身份验证