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

求指导:如何用PowerShell设置Azure企业应用SAML断言签名为True

解决Azure企业应用SAML断言签名的PowerShell配置问题

核心说明

Azure门户中的“签名SAML断言”对应PowerShell(通过Graph或AzureAD模块)里的signAssertion属性,并非直接在证书设置中操作——证书是签名所用的密钥,而断言签名是独立的SAML配置项。

使用Microsoft Graph PowerShell模块操作(推荐,AzureAD模块已废弃)

  1. 安装并登录模块:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Application.ReadWrite.All"
  1. 获取目标企业应用的ID:
$targetAppName = "你的企业应用名称"
$app = Get-MgServicePrincipal -Filter "DisplayName eq '$targetAppName'"
$appId = $app.Id
  1. 定位SAML单点登录配置:
$samlSsoConfig = Get-MgServicePrincipalSingleSignOnConfiguration -ServicePrincipalId $appId | 
    Where-Object { $_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.samlSingleSignOnSettings' }
  1. 更新断言签名设置为True:
$updateParams = @{
    AdditionalProperties = @{
        "@odata.type"       = "#microsoft.graph.samlSingleSignOnSettings"
        "signAssertion"     = $true
        # 保留原有配置中的其他必要属性,避免覆盖
        "signingAlgorithm"  = $samlSsoConfig.AdditionalProperties.signingAlgorithm
        "relayState"        = $samlSsoConfig.AdditionalProperties.relayState
    }
}

Update-MgServicePrincipalSingleSignOnConfiguration -ServicePrincipalId $appId -SingleSignOnConfigurationId $samlSsoConfig.Id -BodyParameter $updateParams

旧AzureAD模块操作(兼容旧环境)

如果仍在使用即将废弃的AzureAD模块,可执行以下命令:

Install-Module AzureAD -Scope CurrentUser
Connect-AzureAD

$targetAppName = "你的企业应用名称"
$app = Get-AzureADServicePrincipal -Filter "DisplayName eq '$targetAppName'"
$samlSsoConfig = Get-AzureADServicePrincipalSingleSignOnConfiguration -ObjectId $app.ObjectId | Where-Object { $_.Type -eq "SAML" }

$samlSsoConfig.SignAssertion = $true
Set-AzureADServicePrincipalSingleSignOnConfiguration -ObjectId $app.ObjectId -SingleSignOnConfiguration $samlSsoConfig

和Terraform Enterprise配置的对应关系

你提到的Terraform Enterprise中的want_assertions_signed是服务端要求断言必须签名,而Azure这边的signAssertion = $true是身份提供者(IdP)主动对断言签名,两者配合使用才能满足Terraform Enterprise的SAML验证要求。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.19 20:56:07