管理 SSO 以启用 SSO 时 SupportMultipleDomain Office 365
备注
Office 365 ProPlus 正在重命名为 适用于企业的 Microsoft 365 应用。 有关此更改的详细信息, 请阅读此博客文章。
摘要
使用 ADFS 管理 SSO 以Office 365 SupportMultipleDomain 开关
通过 ADFS 为 O365 启用 SSO 时,应该会看到为 O365 创建的信赖 (RP) 信任。
下面列出了为 O365 创建 RP 信任的命令
New-MsolFederatedDomain -DomainName<domain>
Update-MSOLFederatedDomain -DomainName <domain>
Convert-MsolDomainToFederated -DomainName <domain>
上面创建的 RP 信任有两个声明规则
Get-MsolFederationProperty -DomainName <domain> 在联盟域上显示,源 ADFS 和 O365 的"FederationServiceIdentifier"是相同的,即 http://stsname/adfs/Services/trust 。
在 ADFS 汇总1和汇总Microsoft Office 365 2更新之前,通过 AD FS 2.0 使用单一登录 (SSO) 并在其组织内部具有多个顶级域的用户主体名称 (UPN) 后缀的 (或) 需要为每个后缀 @contoso.com 部署 @fabrikam.com 单独的 AD FS 2.0 联合身份验证服务实例的 客户。 现在,AD FS 2.0 () 汇总与"SupportMultipleDomain"开关结合使用,使 AD FS 服务器能够支持此方案,而无需其他 https://support.microsoft.com/kb/2607496 AD FS 2.0 服务器。
通过 ADFS 汇总 1 更新,我们添加了以下功能
多个颁发者支持
"以前,要求使用 AD FS 2.0 单一登录 (SSO) 并使用用户用户主体名称 (UPN) 后缀的 Microsoft Office 365 客户(例如 (或) )需要为每个后缀部署 @contoso.us @contoso.de 单独的 AD FS 2.0 联合身份验证服务实例。 在服务器场中所有 AD FS 2.0 联合服务器上安装此更新汇总并按照将此功能与 Office 365 一同使用的说明操作后,新的声明规则将设置为基于 Office 365 用户的 UPN 后缀动态生成令牌颁发者 ID。 因此,不必设置 AD FS 2.0 联合服务器的多个实例,为 Office 365 中的多个顶级域支持 SSO。"
支持多个Top-Level域
"目前,使用单一登录 (SSO) 至 AD FS 2.0 且其组织内部用户主体名称 (UPN) 后缀有多个顶级域的 Microsoft Office 365 客户(例如 () )需要部署每个后缀 @contoso.com @fabrikam.com 的 AD FS 2.0 联合身份验证服务的单独实例。 现在,AD FS 2.0 () 汇总与"SupportMultipleDomain"开关结合使用,使 AD FS 服务器能够支持此方案,而无需其他 https://support.microsoft.com/kb/2607496 AD FS 2.0 服务器。"
下面列出了为 O365 创建 RP 信任的命令
New-MsolFederatedDomain -DomainName<domain>-SupportMultiDomain
Update-MSOLFederatedDomain -DomainName <domain>-SupportMultipleDomain
Convert-MsolDomainToFederated -DomainName <domain>-supportMultipleDomain
Get-MsolFederationProperty -DomainName <domain> 现在,联合域中的 "FederationServiceIdentifier" 与 ADFS 和 O365 不同。 每个联合域都将"FederationServiceIdentifier"作为 http://<domainname>/adfs/services/trust/ ,而 ADFS 配置仍具有 http://STSname/adfs/Services/trust 。
由于此配置不匹配,我们需要确保在将令牌发送到 O365 时,其中提及的颁发者与在 O365 中为 Domain 配置的颁发者相同。 否则,你将收到以下错误:
因此,当使用 SupportMultipleDomain 开关添加或更新 RP 信任时,第三个声明规则会自动添加到 O365 的 RP 信任中。
默认第三个规则:
c:[Type == " http://schemas.xmlsoap.org/claims/UPN](http://schemas.xmlsoap.org/claims/UPN "] => issue (Type = " https://schemas.microsoft.com/ws/2008/06/identity/claims/issuerid ", Value = regexreplace (c.Value, . +@(?<domain>.+) , http://${domain}/adfs/services/trust/) ) ;
此规则使用用户的 UPN 的后缀值,并使用该后缀值生成名为"Issuerid"的新声明。 示例 http://contoso.com/adfs/services/trust/。
使用 fiddler,我们可以跟踪传递到 login.microsoftonline.com/login.srf。 复制传入的令牌后,将内容粘贴到记事本中,然后将该文件另存 wresult 为.xml。
稍后,可以使用 IE 打开另存为.xml令牌并查看其内容。
值得注意的是,规则发出"Issuerid"声明,我们在响应令牌中看不到此声明,事实上,我们看到"Issuer"属性已修改为新组合的值。
<saml:Assertion MajorVersion="1" MinorVersion="1" AssertionID="_2546eb2e-a3a6-4cf3-9006-c9f20560097f"Issuer="[http://contoso.com/adfs/services/trust/](http://contoso.com/adfs/services/trust/)" IssueInstant="2012-12-23T04:07:30.874Z" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion">
注释
使用 SupportMultipleDomain 时未安装 ADFS 汇总 1 或 2。 你将看到 ADFS 生成的响应令牌具有 Issuer=" " 和声明"Issuerid",根据第三个声明规则,其组合
http://STSname/adfs/Services/trust值具有。<saml:Assertion MajorVersion="1" MinorVersion="1" AssertionID="_2546eb2e-a3a6-4cf3-9006-c9f20560097f"Issuer=`http://STS.contoso.com/adfs/services/trust/` IssueInstant="2012-12-23T04:07:30.874Z" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"> … <saml:Attribute AttributeName="issuerid" AttributeNamespace="[http://schemas.microsoft.com/ws/2008/06/identity/claims](http://schemas.microsoft.com/ws/2008/06/identity/claims)"><saml:AttributeValue>[http://contoso.com/adfs/services/trust/</saml:AttributeValue](http://contoso.com/adfs/services/trust/%3c/saml:AttributeValue)></saml:Attribute> - This will again lead to error "Your organization could not sign you in to this service"
支持子域
"值得注意的是,当您具有一个顶级域和多个子域时,不需要"SupportMultipleDomain"开关。 例如,如果用于 upn 后缀的域是 、 和 ,并且顶级域 (contoso.com 在这种情况下,) 已首先添加并联合,则无需使用 @sales.contoso.com @marketing.contoso.com @contoso.com "SupportMultipleDomain"开关。 这些子域在父域范围内得到有效管理,并且可以使用单个 AD FS 服务器来处理这一问题。"
但是,如果您有多个顶级域 (和) ,并且这些域还具有子域 (和 @contoso.com @fabrikam.com @sales.contoso.com @sales.fabrikam.com) ,则"SupportMultipleDomain"开关将不能用于子域,并且这些用户将无法登录。
为什么此开关在以上方案中不起作用?
回答:
对于共享同一命名空间的子域,我们不会将它们分开联合。 联合根域也覆盖子域,这意味着子域的 federationServiceIdentifier 值也将与父域的 federationServiceIdentifier 值相同,即
https://contoso.com/adfs/services/trust/。但是,最后为用户选取 UPN 后缀以撰写 Issuer 值的第三个声明规则以 结尾,再次导致不匹配,因此出现错误"你的组织无法登录
https://Child1.contoso.com/adfs/services/trust/此服务"。若要解决此问题,请修改第三个规则,使规则最终生成与 O365 结尾域的"FederationServiceIdentifier"匹配的 Issuer 值。 下面是可在此方案中工作的两个不同规则。 此规则仅从 UPN 后缀选取根域以构成 Issuer 值。 对于 UPN 后缀 child1.contoso.com,它仍将生成 Issuer 值,而不是使用默认规则 (
https://contoso.com/adfs/services/trust/https://Child1.contoso.com/adfs/services/trust/值)
自定义的第三个规则
规则 1:
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/"));
规则 2:
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>[^.]*.(com|net|co|org)(.\w\w)?)$", "[http://${domain}/adfs/services/trust/](http://$%7bdomain%7d/adfs/services/trust/)"));
注释
上述规则可能并非适用于所有方案,但可以自定义以确保"Issuerid"值与在 O365 结尾添加/联合的域的"FederationServiceIdentifier"相匹配。
ADFS 与域的 O365 之间的 federationServiceIdentifier 不匹配也可通过修改 O365 结尾的域的"federationServiceIdentifier"来更正,以匹配 ADFS 的"federationServiceIdentifier"。 但是,只能为 ONE 联盟域(而不是全部)配置 federationServiceIdentifier。
Set-MSOLDomainFederationSettings -domain name Contoso.com –issueruri http://STS.contoso.com/adfs/services/trust/