active-directory – Office 365 ADFS身份验证不适用于子域

一家公司正在使用Office 365和ADFS身份验证; AD Connect用于目录同步,ADFS是 Windows Server 2012 R2版本.

该公司有多个Active Directory域:

parent1.com
    child1.parent1.com
    child2.parent1.com
    child3.parent1.com
parent2.com
    ...
...

根域在Office 365中配置为联合域(公共域名和AD域名相同);这很好用,用户可以使用他们的UPN登录到Office 365,例如user1@parent1.com,以及他们的AD密码.

我需要添加对子域的支持;因此,我通过运行以下命令将child1.parent1.com添加到Office 365(使用Connect-MsolService连接到具有管理员帐户的Office 365之后):

New-MsolFederatedDomain -DomainName child1.parent1.com -SupportMultipleDomain

(N.B.如果我没有使用SupportMultipleDomain参数,PowerShell会给出一个错误,说明它是必需的).

然后我继续在私有和公共DNS中添加所有必需的DNS记录; Office 365验证DNS记录报告一切正常.

然后将子域添加到AD Connect,并执行同步;因此,子域中的用户出现在Office 365中,其用户名如user1@child1.parent1.com.我为他们分配了适当的许可证,并尝试登录Office 365门户.

但是,子域的用户无法登录;他们收到“无效请求”错误,并提供以下附加详细信息:

Correlation ID: b1e47d45-b21c-42e9-9758-265804db7171 
Timestamp: 2016-08-10 20:27:48Z 
AADSTS50107: Requested federation realm
object 'http://child1.parent1.com/adfs/services/trust/' does not exist.

在ADFS方面显然有些不对劲,但我不是它的专家,我也不是那个设置它的人;如何解决此问题,以便子域中的用户可以成功登录到Office 365?

这个问题很少被记录( a Technet blog postsome documentation for Azure AD),但它确实存在,并且它是由ADFS在某些特定情况下不能正常运行(多个顶级联合域并在混合中抛出联合子域)引起的;该解决方案涉及在ADFS声明规则中编辑正则表达式,该规则用于构建与用户的UPN关联的IssuerUri.引自第二篇文章
So lets say for example that I have bmcontoso.com and then add
corp.bmcontoso.com. This means that the IssuerUri for a user from
corp.bmcontoso.com will need to be http://bmcontoso.com/adfs/services/trust.
However the standard rule implemented above for Azure AD,will generate a
token with an issuer as http://corp.bmcontoso.com/adfs/services/trust
which will not match the domain's required value and authentication will fail.

解决此问题,应编辑ADFS中的第三个声明规则

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/"));

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

但是,请注意这可能会破坏与其他方案的兼容性,例如其父域未联合的实际第三级联合域.

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...