【问题标题】:Getting immutableid of an office365/azure user for the SAML assertion为 SAML 断言获取 office365/azure 用户的 immutableid
【发布时间】:2020-01-31 13:42:28
【问题描述】:
查看他们的文档 (https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-fed-saml-idp),看起来我们在 SAML 断言中需要三件事。
NameID - The value of this assertion must be the same as the Azure AD user’s ImmutableID
IDPEmail - The User Principal Name (UPN) is listed in the SAML response as an element with the name IDPEmail
Issuer - Required to be a URI of the identity provider
我假设 idp 电子邮件只是用户的电子邮件,它对应于 microsoft graph API 中的 userPrincipalName 字段。我们可以很容易地从 API 中获取。
我不确定 ImmutableID 是什么。
有没有办法使用微软的图形 API 来获取它?如果没有,我们如何得到它?
【问题讨论】:
标签:
azure
office365
saml
azureportal
【解决方案1】:
是的,如果设置了 Microsoft Graph Api 的“onPremisesImmutableId”,则可以使用以下端点
https://graph.microsoft.com/v1.0/users?$select=displayname,userprincipalname,givenname,onpremisesimmutableid
如果它为 null,您可以使用以下 powershell 命令显式设置该 ImmutableId。
Set-MsolUser -UserPrincipalName abc@domain -ImmutableId 123
前提是域不能是联合的。如果它是联合的,则必须将其转换为“托管”。
【解决方案2】:
@nkpatel 是的,使用 Graph API,您可以获取不可变 ID 的值。如果用户对象从 On-Prem AD 同步到 AAD,则使用 AAD 连接工具,用户对象将在该用户的 Graph API 响应中具有一个名为“onPremisesImmutableId”的属性。 p>
Eg: GET https://graph.microsoft.com/beta/users/<UPN of the user>
您在此属性“onPremisesImmutableId”下找到的值将包含 Base64Encoded 值。默认情况下,本地用户的 ObjectGUID 采用 base64 编码并存储在 Azure AD 中的“onPremisesImmutableId”中。
希望这会有所帮助。