[英]azure App registration using powershell does not create a service principal
当我们从 azure 门户创建 azure 广告应用注册时,会自动创建服务主体,并赋予贡献者角色,我们如何使用 PowerShell 实现相同的目的?
我尝试运行以下命令创建应用程序但未创建服务主体,并且没有用于配置服务主体的参数
New-AzADApplication -DisplayName "NewApplication" -HomePage "http://www.microsoft.com" -IdentifierUris "http://NewApplication"
我正在寻找的是使用 powershell 创建以下内容,这可能吗?
谢谢
尝试这个:
#set your secret here.
$secretTextValue = "abcdefg1234567890"
$secret = ConvertTo-SecureString -String $secretTextValue -AsPlainText
$app = New-AzADApplication -DisplayName "NewApplication" -HomePage "http://www.microsoft.com" -IdentifierUris "http://NewApplication"
New-AzADAppCredential -ObjectId $app.ObjectId -Password $secret -EndDate (Get-Date).AddMonths(6)
#azure will assign contributor role of current subscription to this SP
New-AzADServicePrincipal -ApplicationId $app.ApplicationId
结果:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.