gpt4 book ai didi

azure - 将自定义声明 "samaccountname"添加到 Azure 广告中时出现问题

转载 作者:行者123 更新时间:2023-12-03 03:36:57 25 4
gpt4 key购买 nike

我需要添加自定义声明“samAccountName”以显示在 token 中(使用 jwt)

首先,我创建了 powershell 脚本

New-AzureADPolicy -Definition @('{
"ClaimsMappingPolicy": {
"Version": 1,
"IncludeBasicClaimSet": "true",
"ClaimsSchema":[{

"Source": "user",
"ID": "onpremisessamaccountname",
"SamlClaimType": "samaccountname",
"JwtClaimType": "samAccountName"
},
]
}
}') -DisplayName "att_ext_samaccountname_even2_prod" -Type "ClaimsMappingPolicy"

我将新策略设置为我的 objectid,看起来没问题 enter image description here

在 azure list 中,我输入了“acceptMappedClaims”:true,它看起来像这样

enter image description here

但在“ token 配置 -> 可选声明”中,它看起来像这样(警告标志)

enter image description here

当选择“添加可选声明”时,我找不到要添加的声明

对我做错了什么或者缺少什么有什么想法吗?

提前致谢

最佳答案

我尝试在我的环境中重现相同的结果并得到以下结果:

我将 acceptedMappedClaims 修改为 true 并在应用 list 中添加了扩展程序,如下所示:

enter image description here

并得到与以下相同的错误:

enter image description here

或者,我使用下面的 PowerShell 命令在 token 中添加 samaccountname 扩展,如下所示:

$MyApp = (New-AzureADApplication -DisplayName "AppName").ObjectId  

New-AzureADServicePrincipal -AppId (Get-AzureADApplication -SearchString "AppName").AppId

New-AzureADApplicationExtensionProperty -ObjectId $MyApp -Name "samaccountname" -DataType "String" -TargetObjects "User"

Set-AzureADUserExtension -ObjectId ServicePrincipalObjectId -ExtensionName "extension_XXXX_samaccountname" -ExtensionValue "Value"

执行上述命令后,我得到如下响应:

enter image description here

我能够将 samaccountname 添加为 Azure 门户中的可选声明,如下所示:

enter image description here

解码 token (使用授权代码生成)后,流程成功获得samaccountname,如下所示:

enter image description here

欲了解更多详情,请引用以下链接:

Azure AD cmdlets to work with extension attributes | Microsoft Docs

Inlcude onpemise samaccount in azure ad claims by soumi-MSFT

关于azure - 将自定义声明 "samaccountname"添加到 Azure 广告中时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72980955/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com