You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过PowerShell为Azure AD应用添加多个identifierURIs

为Azure AD应用添加多个IdentifierURIs的PowerShell方法

要一次性添加多个IdentifierURIs,只需要将参数值改为字符串数组即可,具体操作分两种场景:

场景1:直接设置多个URI(覆盖原有值)

如果不需要保留现有URI,直接传递包含多个URI的数组给-IdentifierURIs参数:

$appId = "你的应用ID"
Set-AzureADApplication -DisplayName "My App" -IdentifierURIs @("api://$appId", "https://contoso.com/myapp", "urn:myapp:contoso")

这里用@()包裹多个URI字符串,每个URI用引号分隔,PowerShell会识别为数组传递给参数。

场景2:追加新URI到现有列表(不覆盖原有值)

如果需要保留已有的URI并添加新的,必须先获取应用当前的URI列表,合并后再更新:

# 获取目标应用对象
$app = Get-AzureADApplication -Filter "DisplayName eq 'My App'"

# 定义要添加的新URI
$newUris = @("https://contoso.com/myapp/v2", "api://$($app.AppId)/admin")

# 合并现有URI与新URI,自动去重避免重复
$updatedUris = $app.IdentifierUris + $newUris | Select-Object -Unique

# 更新应用的IdentifierURIs
Set-AzureADApplication -ObjectId $app.ObjectId -IdentifierURIs $updatedUris

注意事项

  • 每个IdentifierURI在Azure AD租户内必须唯一,不能与其他应用重复
  • URI格式需符合规范,支持api://、https://、urn:等前缀

内容的提问来源于stack exchange,提问作者JeethK

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 10:45:25