共用方式為


手動設定 Microsoft Entra 混合式聯結

如果您可以選擇使用 Microsoft Entra Connect,請參閱設定 Microsoft Entra 混合式聯結中的指導方針。 在 Microsoft Entra Connect 中使用自動化,大幅簡化 Microsoft Entra 混合式聯結的設定。

本文涵蓋手動設定 Microsoft Entra 混合式聯結的需求,包括管理和同盟網域的步驟。

必要條件

  • Microsoft Entra Connect
    • 若要讓裝置註冊同步加入成功,在裝置註冊設定的過程中,請勿從您的 Microsoft Entra Connect 同步設定中排除預設裝置屬性。 若要深入了解同步處理至 Microsoft Entra ID 的預設裝置屬性,請參閱 Microsoft Entra Connect 同步處理的屬性
    • 如果您要已加入 Microsoft Entra 混合式裝置的電腦物件屬於特定組織單位 (OU),請在 Microsoft Entra Connect 中設定正確的 OU 以進行同步處理。 若要深入了解如何使用 Microsoft Entra Connect 來同步處理電腦物件,請參閱組織單位型篩選
  • 每個內部部署 Active Directory Domain Services 樹系的企業系統管理員認證。
  • (針對同盟網域) Windows Server,並已安裝 Active Directory 同盟服務。
  • 使用者可使用 Microsoft Entra ID 註冊裝置。 如需此設定的詳細資訊,請參閱本文中「設定裝置設定」標題底下的設定裝置設定

要使用 Microsoft Entra 混合式加入,您的裝置必須能夠從組織的網路中存取下列 Microsoft 資源:

  • https://enterpriseregistration.windows.net
  • https://login.microsoftonline.com
  • https://device.login.microsoftonline.com
  • https://autologon.microsoftazuread-sso.com (如果您要使用或計劃使用無縫單一登入)
  • 組織的 Security Token Service (STS) (適用於同盟網域)

警告

如果貴組織使用的 Proxy 伺服器會在防止資料遺失或 Microsoft Entra 租用戶限制等案例中攔截 SSL 流量,請確認已從 TLS 中斷和檢查 (TLS break-and-inspect) 中排除這些 URL 的流量。 無法排除這些 URL 可能對用戶端憑證驗證造成的干擾,進而產生裝置註冊和裝置型條件式存取的問題。

如果組織需要透過輸出 Proxy 來存取網際網路,您可以使用 Web Proxy 自動探索 (WPAD),讓 Windows 10 或更新版本電腦能向 Microsoft Entra ID 進行裝置註冊。 若要解決 WPAD 的設定和管理問題,請參閱針對自動偵測進行疑難排解

如果您未使用 WPAD,則從 Windows 10 1709 開始,您可以在電腦上設定 WinHTTP Proxy 設定。 如需詳細資訊,請參閱群組原則物件 (GPO) 所部署的 WinHTTP Proxy 設定

注意

如果您使用 WinHTTP 設定在電腦上設定 Proxy 設定,則任何無法連線到所設定 Proxy 的電腦將無法連線到網際網路。

如果貴組織需要透過已驗證的輸出 Proxy 存取網際網路,請確定 Windows 10 或更新版本電腦可以成功向輸出 Proxy 進行驗證。 因為 Windows 10 或更新版本電腦會使用電腦內容來執行裝置註冊,所以請使用電腦內容來設定輸出 Proxy 驗證。 請向您的輸出 Proxy 提供者洽詢相關設定需求。

請使用測試裝置註冊連線能力指令碼,來確認裝置是否能夠在系統帳戶下存取必要的 Microsoft 資源。

組態

您可以設定已加入的 Microsoft Entra 混合式裝置,以用於各種類型的 Windows 裝置平台。

完成這些設定之後,請遵循指導驗證註冊

設定服務連接點

您的裝置會在註冊期間使用服務連接點 (SCP) 物件來探索 Microsoft Entra 租用戶資訊。 在內部部署 Active Directory 執行個體中,已加入 Microsoft Entra 混合式的裝置所使用的 SCP 物件必須存在於電腦樹系的組態命名內容分割區中。 每個樹系只有一個組態命名內容。 在多樹系 Active Directory 組態中,服務連接點必須存在於有已加入網域的電腦包含在其中的所有樹系中。

SCP 物件包含兩個關鍵字值:azureADid:<TenantID>azureADName:<verified domain>azureADName 關鍵字中的 <verified domain> 值會指定裝置在從您內部部署 Active Directory 執行個體讀取 SCP 值之後所遵循的裝置註冊流程類型 (同盟或受控)。 如需受控和同盟流程的詳細資訊,請參閱 Microsoft Entra 裝置註冊的運作方式一文。

您可以使用 Get-ADRootDSE Cmdlet 來擷取樹系的組態命名內容。

如果樹系的 Active Directory 網域名稱為 fabrikam.com,則組態命名內容為:

CN=Configuration,DC=fabrikam,DC=com

在您的樹系中,用於自動註冊已加入網域裝置的 SCP 物件位於︰

CN=62a0ff2e-97b9-4513-943f-0d221bd30080,CN=Device Registration Configuration,CN=Services,[Your Configuration Naming Context]

根據您部署 Microsoft Entra Connect 的方式,可能已設定好 SCP 物件。 您可以使用下列 PowerShell 指令碼確認物件是否存在,並擷取探索值:

$scp = New-Object System.DirectoryServices.DirectoryEntry;

$scp.Path = "LDAP://CN=62a0ff2e-97b9-4513-943f-0d221bd30080,CN=Device Registration Configuration,CN=Services,CN=Configuration,DC=fabrikam,DC=com";

$scp.Keywords;

$scp.Keywords 的輸出會顯示 Microsoft Entra 租用戶資訊。 以下是範例:

azureADName:microsoft.com
azureADId:a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1

設定宣告的發行

在同盟 Microsoft Entra 組態中,裝置須依賴 AD FS 或 Microsoft 合作夥伴的內部部署同盟服務向 Microsoft Entra 進行驗證。 裝置會進行驗證以取得向 Microsoft Entra 裝置註冊服務 (Azure DRS) 註冊的存取權杖。

現行 Windows 裝置會使用整合式 Windows 驗證向內部部署同盟服務所裝載的作用中 WS-Trust 端點 (1.3 或 2005 版) 進行驗證。

使用 AD FS 時,您必須啟用下列 WS-Trust 端點:

  • /adfs/services/trust/2005/windowstransport
  • /adfs/services/trust/13/windowstransport
  • /adfs/services/trust/2005/usernamemixed
  • /adfs/services/trust/13/usernamemixed
  • /adfs/services/trust/2005/certificatemixed
  • /adfs/services/trust/13/certificatemixed

警告

adfs/services/trust/2005/windowstransportadfs/services/trust/13/windowstransport 都只能啟用為內部網路對應端點,且不得透過 Web 應用程式 Proxy 公開為內部網路對應端點。 若要深入了解如何停用 WS-Trust Windows 端點,請參閱在 Proxy上停用 WS-Trust Windows 端點。 您可以在 AD FS 管理主控台的 [服務]>[端點] 下方查看已啟用的端點。

注意

如果您未以 AD FS 作為內部部署同盟服務,請依照廠商的指示確定他們支援 WS-Trust 1.3 或 2005 端點,且這些端點可透過中繼資料交換檔 (MEX) 發佈。

下列宣告必須存在於 Azure DRS 所收到的權杖中,裝置註冊才能完成。 Azure DRS 會在 Microsoft Entra ID 中建立含有其中部分資訊的裝置物件。 然後,Microsoft Entra Connect 會使用這項資訊,讓新建立的裝置物件與內部部署的電腦帳戶產生關聯。

  • http://schemas.microsoft.com/ws/2012/01/accounttype
  • http://schemas.microsoft.com/identity/claims/onpremobjectguid
  • http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid

如果您需要多個經過驗證的網域名稱,您必須為電腦提供下列宣告︰

  • http://schemas.microsoft.com/ws/2008/06/identity/claims/issuerid

如果您已發出 ImmutableID 宣告 (例如,使用 mS-DS-ConsistencyGuid 或另一個屬性作為 ImmutableID 的來源值),則必須為電腦提供一個對應宣告:

  • http://schemas.microsoft.com/LiveID/Federation/2008/05/ImmutableID

在下列各節中,您可找到下列相關資訊:

  • 每個宣告都應具備的值。
  • AD FS 中所將顯示的定義。

此定義可協助您確認值是否存在,或者您是否需要加以建立。

注意

如果您未將 AD FS 用於您的內部部署同盟伺服器,請依照廠商的指示來建立適當組態以發出這些宣告。

發出帳戶類型宣告

http://schemas.microsoft.com/ws/2012/01/accounttype 宣告必須包含 DJ 值,此值可將裝置識別為已加入網域的電腦。 在 AD FS 中,您可以新增發行轉換規則,如下所示︰

@RuleName = "Issue account type for domain-joined computers"
c:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid",
   Value =~ "-515$",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
=> issue(
   Type = "http://schemas.microsoft.com/ws/2012/01/accounttype",
   Value = "DJ"
);

發出內部部署電腦帳戶的 objectGUID

http://schemas.microsoft.com/identity/claims/onpremobjectguid 宣告必須包含內部部署電腦帳戶的 objectGUID 值。 在 AD FS 中,您可以新增發行轉換規則,如下所示︰

@RuleName = "Issue object GUID for domain-joined computers"
c1:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid",
   Value =~ "-515$", 
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
&&
c2:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
=> issue(
   store = "Active Directory",
   types = ("http://schemas.microsoft.com/identity/claims/onpremobjectguid"),
   query = ";objectguid;{0}",
   param = c2.Value
);

發出內部部署電腦帳戶的 objectSid

http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid 宣告必須包含內部部署電腦帳戶的 objectSid 值。 在 AD FS 中,您可以新增發行轉換規則,如下所示︰

@RuleName = "Issue objectSID for domain-joined computers"
c1:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid",
   Value =~ "-515$",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
&&
c2:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
=> issue(claim = c2);

Azure AD 中有多個已驗證的 issuerID 時,發出電腦的 Microsoft Entra ID

http://schemas.microsoft.com/ws/2008/06/identity/claims/issuerid 宣告必須包含與發行權杖的內部部署同盟服務 (AD FS 或合作夥伴) 連線的任何已驗證網域名稱的統一資源識別項 (URI)。 在 AD FS 中,您可以在上述內容之後,以該特定順序新增如下所示的發行轉換規則。 需要有一個規則可為使用者明確發出此規則。 在下列規則中新增的第一個規則會用來識別使用者,而不是電腦驗證。

@RuleName = "Issue account type with the value User when its not a computer"
NOT EXISTS(
[
   Type == "http://schemas.microsoft.com/ws/2012/01/accounttype",
   Value == "DJ"
]
)
=> add(
   Type = "http://schemas.microsoft.com/ws/2012/01/accounttype",
   Value = "User"
);

@RuleName = "Capture UPN when AccountType is User and issue the IssuerID"
c1:[
   Type == "http://schemas.xmlsoap.org/claims/UPN"
]
&&
c2:[
   Type == "http://schemas.microsoft.com/ws/2012/01/accounttype",
   Value == "User"
]
=> issue(
   Type = "http://schemas.microsoft.com/ws/2008/06/identity/claims/issuerid",
   Value = regexreplace(
   c1.Value,
   ".+@(?<domain>.+)",
   "http://${domain}/adfs/services/trust/"
   )
);

@RuleName = "Issue issuerID for domain-joined computers"
c:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid",
   Value =~ "-515$",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
=> issue(
   Type = "http://schemas.microsoft.com/ws/2008/06/identity/claims/issuerid",
   Value = "http://<verified-domain-name>/adfs/services/trust/"
);

在上述宣告中,<verified-domain-name> 是預留位置。 請將其取代為您在 Microsoft Entra AD 中已驗證的網域名稱之一。 例如,使用 Value = "http://contoso.com/adfs/services/trust/"

如需已驗證之網域名稱的資訊,請參閱將自訂網域名稱新增至 Microsoft Entra ID

若要取得已驗證之公司網域的清單,您可以使用 Get-MgDomain Cmdlet。

公司網域的清單

當有使用者 ImmutableID 存在時,為電腦發出 ImmutableID (例如,使用 mS-DS-ConsistencyGuid 作為 ImmutableID 的來源)

http://schemas.microsoft.com/LiveID/Federation/2008/05/ImmutableID 宣告必須包含電腦的有效值。 在 AD FS 中,您可以新增發行轉換規則,如下所示︰

@RuleName = "Issue ImmutableID for computers"
c1:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid",
   Value =~ "-515$",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
&&
c2:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
=> issue(
   store = "Active Directory",
   types = ("http://schemas.microsoft.com/LiveID/Federation/2008/05/ImmutableID"),
   query = ";objectguid;{0}",
   param = c2.Value
);

建立 AD FS 發行轉換規則的協助程式指令碼

下列指令碼可協助您建立前述的發行轉換規則。

$multipleVerifiedDomainNames = $false
$immutableIDAlreadyIssuedforUsers = $false
$oneOfVerifiedDomainNames = 'example.com'   # Replace example.com with one of your verified domains

$rule1 = '@RuleName = "Issue account type for domain-joined computers"
c:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid",
   Value =~ "-515$",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
=> issue(
   Type = "http://schemas.microsoft.com/ws/2012/01/accounttype",
   Value = "DJ"
);'

$rule2 = '@RuleName = "Issue object GUID for domain-joined computers"
c1:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid",
   Value =~ "-515$",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
&&
c2:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
=> issue(
   store = "Active Directory",
   types = ("http://schemas.microsoft.com/identity/claims/onpremobjectguid"),
   query = ";objectguid;{0}",
   param = c2.Value
);'

$rule3 = '@RuleName = "Issue objectSID for domain-joined computers"
c1:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid",
   Value =~ "-515$",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
&&
c2:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
=> issue(claim = c2);'

$rule4 = ''
if ($multipleVerifiedDomainNames -eq $true) {
$rule4 = '@RuleName = "Issue account type with the value User when it is not a computer"
NOT EXISTS(
[
   Type == "http://schemas.microsoft.com/ws/2012/01/accounttype",
   Value == "DJ"
]
)
=> add(
   Type = "http://schemas.microsoft.com/ws/2012/01/accounttype",
   Value = "User"
);

@RuleName = "Capture UPN when AccountType is User and issue the IssuerID"
c1:[
   Type == "http://schemas.xmlsoap.org/claims/UPN"
]
&&
c2:[
   Type == "http://schemas.microsoft.com/ws/2012/01/accounttype",
   Value == "User"
]
=> issue(
   Type = "http://schemas.microsoft.com/ws/2008/06/identity/claims/issuerid",
   Value = regexreplace(
   c1.Value,
   ".+@(?<domain>.+)",
   "http://${domain}/adfs/services/trust/"
   )
);

@RuleName = "Issue issuerID for domain-joined computers"
c:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid",
   Value =~ "-515$",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
=> issue(
   Type = "http://schemas.microsoft.com/ws/2008/06/identity/claims/issuerid",
   Value = "http://' + $oneOfVerifiedDomainNames + '/adfs/services/trust/"
);'
}

$rule5 = ''
if ($immutableIDAlreadyIssuedforUsers -eq $true) {
$rule5 = '@RuleName = "Issue ImmutableID for computers"
c1:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid",
   Value =~ "-515$",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
&&
c2:[
   Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname",
   Issuer =~ "^(AD AUTHORITY|SELF AUTHORITY|LOCAL AUTHORITY)$"
]
=> issue(
   store = "Active Directory",
   types = ("http://schemas.microsoft.com/LiveID/Federation/2008/05/ImmutableID"),
   query = ";objectguid;{0}",
   param = c2.Value
);'
}

$existingRules = (Get-ADFSRelyingPartyTrust -Identifier urn:federation:MicrosoftOnline).IssuanceTransformRules

$updatedRules = $existingRules + $rule1 + $rule2 + $rule3 + $rule4 + $rule5

$crSet = New-ADFSClaimRuleSet -ClaimRule $updatedRules

Set-AdfsRelyingPartyTrust -TargetIdentifier urn:federation:MicrosoftOnline -IssuanceTransformRules $crSet.ClaimRulesString

備註

  • 此指令碼會將規則附加至現有的規則。 請勿執行此指令碼兩次,因為會新增這組規則兩次。 先確定這些宣告沒有對應的規則存在 (在對應的條件下),才能再次執行指令碼。

  • 如果您有多個經過驗證的網域名稱,請將指令碼中 $multipleVerifiedDomainNames 的值設為 $true。 此外,也務必移除經由 Microsoft Entra Connect 或其他方式建立的現有 issuerid 宣告。 此規則的範例如下︰

    c:[Type == "http://schemas.xmlsoap.org/claims/UPN"]
    => issue(Type = "http://schemas.microsoft.com/ws/2008/06/identity/claims/issuerid", Value = regexreplace(c.Value, ".+@(?<domain>.+)",  "http://${domain}/adfs/services/trust/")); 
    

如果您已針對使用者帳戶發出 ImmutableID 宣告,請將指令碼中的 $immutableIDAlreadyIssuedforUsers 值設為 $true

對您的實作進行疑難排解

如果您為已加入網域的 Windows 裝置完成 Microsoft Entra 混合式聯結時遇到問題,請參閱: