我是 Microsoft Entra id 的新手,正在尝试使用 Az 模块 powerhsell 脚本创建应用程序注册,并且还想使用以下内容更新其清单文件
"trustedCertificateSubjects": [
{
"authorityId": "00000000-0000-0000-0000-000000000001",
"subjectName": "subjectname1",
"revokedCertificateIdentifiers": []
},
{
"authorityId": "00000000-0000-0000-0000-000000000001",
"subjectName": "subjectname2",
"revokedCertificateIdentifiers": []
}
]
下面的脚本我用来创建应用程序注册,并且需要修改此 powershell 脚本以更新清单文件。
param(
[Parameter(Mandatory=$true)]
[string]$Environment,
[Parameter(Mandatory=$true)]
[string]$PartnerName
)
switch ($Environment) {
'test' {
$PartnerAppSuffix = '-test'
}
'dev' {
$PartnerAppSuffix = '-dev'
}
}
# Check if the app already exists
$App = Get-AzADServicePrincipal -Filter "DisplayName eq '$PartnerName$PartnerAppSuffix'"
if ($App -eq $null) {
# If the app doesn't exist, create a new one
$appName = $PartnerName+$PartnerAppSuffix
$redirectUris = @("https://mscloud.onmicrosoft.com/$appName")
$secretName = "secretKey"
$App = New-AzADApplication -DisplayName $appName `
-ReplyUrls $redirectUris `
-Homepage "https://mscloud.onmicrosoft.com/$appName" `
-IdentifierUris "https://mscloud.onmicrosoft.com/$appName" `
-Web @{
ImplicitGrantSetting = @{
EnableAccessTokenIssuance = $true
EnableIdTokenIssuance = $true
}
}
# Create a new service principal for the app
$ServicePrincipal = New-AzADServicePrincipal -ApplicationId $App.AppId
Write-Host "New app registration created. AppId: $($App.AppId)"
} else {
Write-Host "App registration '$PartnerName' already exists. AppId: $($App.AppId)"
}
AFAIK,目前 Azure Az
PowerShell 模块中没有可用的命令,可直接允许使用
trustedCertificateSubjects
更新 Azure AD 应用程序的清单。仅可以通过编程方式更新此 MS 文档中定义的预定义清单参数。 目前,您只能通过 Azure 门户中的
Manifest
选项卡手动更新它,如下所示:
"trustedCertificateSubjects": [
{
"authorityId": "00000000-0000-0000-0000-000000000001",
"subjectName": "subjectname1",
"revokedCertificateIdentifiers": []
},
{
"authorityId": "00000000-0000-0000-0000-000000000001",
"subjectName": "subjectname2",
"revokedCertificateIdentifiers": []
}
]
要使用
Az