【发布时间】:2018-03-24 10:00:02
【问题描述】:
我在 Azure 应用服务上有一个需要 Azure Active Directory 身份验证的 Web 应用。我可以使用OAuth 2.0 flow for service-to-service communication 或Managed Service Identity (MSI) 从其他应用程序中连接接收受保护应用程序的访问令牌。
对于 MSI,Microsoft 提供了一个库 Microsoft.Azure.Services.AppAuthentication 用于身份验证,该库还支持使用来自 azure-cli 工具的凭据。
但是,该库目前处于预览状态,它无法在我的系统上运行,但我设法找到了它的 source code on github。
relevant part好像在打电话
$ az account get-access-token <resource>
但是,当我尝试使用我尝试访问的应用程序的资源名称时,我收到以下错误:
Get Token request returned http error: 400 and server response: {"error":"invalid_grant","error_description":"AADSTS65001: The user or administrator has not consented to use the application with ID <application id> named <application name>.
对于资源名称,我尝试了 App ID URI 和 Client ID。
有没有人设法在类似情况下使用azure-cli 获取访问令牌?
【问题讨论】:
标签: azure azure-active-directory