Azure AD 中的自定义属性

问题描述 投票:0回答:1

我有一个与 azure AD 集成的 SAML 应用程序。根据应用程序要求,他们需要来自 Azure 的 SAML 响应中的其他属性。因此,我们需要添加额外的属性,以便我们可以在声明中发送它们。如何添加自定义属性并在我的企业应用程序中使用它。 例如。 lang=en 如何在 AAD 中添加此属性并将其添加到我的 SAML 应用程序属性和声明中,以便 AAD 可以在 SAML 响应中发送此属性。

azure-active-directory attributes saml-2.0
1个回答
0
投票

我创建了一个 Microsoft Entra SAML 应用程序:

enter image description here

要添加自定义属性,请检查以下内容:

通过传递自定义属性名称创建策略并将其分配给服务主体:

New-AzureADPolicy -Definition @('
{
    "ClaimsMappingPolicy":
    {
        "Version":1,"IncludeBasicClaimSet":"true", 
        "ClaimsSchema": [{"Source":"user","ID":"extensionattribute1","SamlClaimType":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/lang","JwtClaimType":"lang"}]
    }
}') -DisplayName "lang" -Type "ClaimsMappingPolicy"

Add-AzureADServicePrincipalPolicy  -RefObjectId 'PolicyID' -Id 'ServicePrincipalObjID'

enter image description here

现在将策略分配给用户:

PATCH https://graph.microsoft.com/v1.0/me

{
"onPremisesExtensionAttributes": {
"extensionAttribute1": "en"
}
}

enter image description here

否则,您可以创建一个新的目录扩展,将它们与现有用户关联并设置如下值:

POST https://graph.microsoft.com/v1.0/applications/appObjID/extensionProperties
Content-type: application/json

{
    "name": "lang",
    "dataType": "String",
    "targetObjects": [
        "User"
    ]
}

enter image description here

现在将属性分配给用户并设置值:

PATCH https://graph.microsoft.com/v1.0/users/<upn>
Content-type: application/json

{
  "extension_xxx_lang": "en"
}

enter image description here

在 Microsoft Entra ID 应用程序中,配置令牌配置

令牌配置 -> 添加可选声明 -> SAML

enter image description here

SAML 声明将作为

http://schemas.microsoft.com/identity/claims/**extn

发出

参考:

如何添加自定义用户属性以在 Azure SAML SSO 中使用? - Microsoft 问答,作者:Siva-kumar-selvaraj

© www.soinside.com 2019 - 2024. All rights reserved.