[英]Creating admin-consent in PowerShell after app registration with Azure CLI make an error
After I created an app I add admin-consent - but it failed on last line创建应用程序后,我添加了 admin-consent - 但在最后一行失败
$myApiAppRegistration = az ad app create --display-name $appName --password $secret --reply-urls $replyUrl --required-resource-accesses $resources --available-to-other-tenants false
$myApiAppRegistrationResult = ($myApiAppRegistration | ConvertFrom-Json)
az ad app permission admin-consent --id $myApiAppRegistrationResult.appId
If run this command in the shell - it works fine.如果在 shell 中运行此命令 - 它工作正常。
Write-Host ' Create Service Principal'
Start-Sleep -Seconds 5
az ad sp create --id $appId
Start-Sleep -Seconds 5
Write-Host ' Add Permission grant'
az ad app permission grant --id $appId --api $graphId
Start-Sleep -Seconds 5
Write-Host ' Admin consent. AppId:' $appId
az ad app permission admin-consent --id $appId
Use az account show
to make sure you logged in the correct admin account in the powershell, and try to specify the --identifier-uris
when you creating the app.使用
az account show
确保您在 powershell 中登录了正确的管理员帐户,并在创建应用程序时尝试指定--identifier-uris
。
$myApiAppRegistration = az ad app create --display-name $appName --password $secret --reply-urls $replyUrl --identifier-uris 'https://testapp777' --required-resource-accesses $resources --available-to-other-tenants false
Before granting consent I have to:在同意之前,我必须:
-- Service Principal
az ad sp create --id $appId |Out-Null
-- Grant Permissions
az ad app permission grant --id $appId --api $graphId
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.