手動設定 Microsoft Entra 混合式聯結

如果使用 Microsoft Entra 連線 是選項,請參閱設定 Microsoft Entra 混合式聯結中的指引。 在 Microsoft Entra 連線 中使用自動化,可大幅簡化 Microsoft Entra 混合式聯結的設定。

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

必要條件

  • Microsoft Entra Connect
    • 若要讓裝置註冊同步加入成功,在裝置註冊設定中,請勿從 Microsoft Entra 連線 同步設定中排除預設裝置屬性。 若要深入瞭解同步處理至 Microsoft Entra 識別符的預設裝置屬性,請參閱 Microsoft Entra 同步處理的屬性 連線
    • 如果您想要加入 Microsoft Entra 混合式聯結之裝置的計算機對象屬於特定組織單位 (OU),請設定正確的 OU 以在 Microsoft Entra 連線 中同步處理。 若要深入瞭解如何使用 Microsoft Entra 連線 同步處理計算機物件,請參閱以組織單位為基礎的篩選
  • 每個 內部部署的 Active Directory Domain Services 樹系的企業系統管理員認證。
  • 適用於同盟網域)已安裝 Active Directory 同盟服務 的 Windows Server。
  • 用戶可以使用 Microsoft Entra 識別元註冊其裝置。 如需此設定的詳細資訊,請參閱設定裝置設定一文中的設定裝置設定標題底下。

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

  • https://enterpriseregistration.windows.net
  • https://login.microsoftonline.com
  • https://device.login.microsoftonline.com
  • https://autologon.microsoftazuread-sso.com (如果您要使用或計劃使用無縫單一登入)
  • 貴組織的安全性令牌服務 (STS) (適用於同盟網域

警告

如果您的組織針對數據外洩防護或 Microsoft Entra 租使用者限制等案例使用攔截 SSL 流量的 Proxy 伺服器,請確定這些 URL 的流量會從 TLS 中斷和檢查中排除。 如果無法排除這些 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 提供者,以取得設定需求。

使用測試裝置註冊 連線 ivity 腳本,確認裝置可以在系統帳戶下存取必要的 Microsoft 資源。

組態

您可以針對各種類型的 Windows 裝置平台設定 Microsoft Entra 混合式聯結裝置。

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

設定服務連接點

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

SCP 物件包含兩個關鍵字值 – azureADid:<TenantID>azureADName:<verified domain>。 關鍵詞<verified domain>中的azureADName值會指定裝置註冊流程的類型(同盟或受管理),裝置會在從您的 內部部署的 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 連線 的方式,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 關鍵詞輸出會顯示 Microsoft Entra 租用戶資訊。 以下是範例:

azureADName:microsoft.com
azureADId:72f988bf-86f1-41af-91ab-2d7cd011db47

設定宣告的發行

在同盟的 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 連線 然後使用這項資訊,將新建立的裝置對象與內部部署電腦帳戶產生關聯。

  • 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);

當多個已驗證功能變數名稱位於 Microsoft Entra ID 時,發行電腦的 issuerID

宣告 http://schemas.microsoft.com/ws/2008/06/identity/claims/issuerid 必須包含任何已驗證功能變數名稱的統一資源識別碼(URI),這些功能變數名稱會與發出令牌的內部部署同盟服務(AD FS 或合作夥伴)連線。 在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 ID 中其中一個已驗證的功能變數名稱。 例如,使用 Value = "http://contoso.com/adfs/services/trust/"

如需已驗證功能變數名稱的詳細資訊,請參閱 將自定義功能變數名稱新增至 Microsoft Entra ID

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

公司網域清單

當有一個使用者存在時,為計算機發出 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 所建立的任何現有 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 混合式加入時遇到問題,請參閱: