gpt4 book ai didi

azure - 无法使用服务主体创建 AD 应用程序

转载 作者:行者123 更新时间:2023-12-03 04:42:05 25 4
gpt4 key购买 nike

C:\> $app = New-AzureRmADApplication -DisplayName "exampleapp" -HomePage "https://www.contoso.org/exampleapp" -IdentifierUris "https://www.contoso.org/exampleapp" -Password "Qwertyu123$"
New-AzureRmADApplication : Resource not found for the segment 'me'.

我可以使用所有者帐户发出相同的命令。问题是这个应用程序几乎拥有 Azure 的所有可能权限(包括所有者)

编辑 - 用于启动 Azure session 的命令:

Add-AzureRmAccount -TenantId $env:tenant_id -ServicePrincipal `
-Credential ([pscredential]::new($env:app_id,(ConvertTo-SecureString -String $env:app_key -AsPlainText -Force)))

permissions example

显然我缺少一些权限,是哪一个?

Body: { "odata.error": { "code": "Authorization_RequestDenied", "message": { "lang": "en", "value": "Insufficient privileges to complete the operation." }, "requestId": "9c3bf711-c9ad-4883-a5cf-fa7926ccdf63", "date": "2017-03-06T10:14:29" } }

最佳答案

我尝试重现您的错误但失败了,这是我的测试步骤:

  1. 在 azure ad classic 门户中,我添加了一个 Web 应用程序: enter image description here
  2. 输入应用名称,选择web应用/web api,输入登录url和应用id url: enter image description here enter image description here
  3. 按照图片所示配置权限: enter image description here
  4. 在 powershell 中,运行 Add-AzureRmAccount 脚本,然后创建一个新应用程序,两者都可以正常工作: enter image description here

请使用fiddle捕获New-AzureRmADApplication的http请求,你会发现它执行了一个rest api: enter image description here

您可以使用在线工具,如 jwt.io 来解码您的访问 token ,请检查“角色”声明,我按照您的图片配置应用程序权限,角色将是: enter image description here

“aud”是 https://graph.windows.net/ 。如果有什么我没有注意到的,请告诉我。

关于azure - 无法使用服务主体创建 AD 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42622891/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com