jak*_*ale 6 azure azure-active-directory
我在Azure App Service上有一个需要Azure Active Directory身份验证的Web应用程序.我可以使用OAuth 2.0流程进行服务到服务通信或托管服务标识(MSI),从其他应用程序中连接受保护应用程序的访问令牌.
对于MSI,Microsoft提供了一个库Microsoft.Azure.Services.AppAuthentication,用于身份验证,该库还支持使用该azure-cli工具的凭据.
但是,该库目前处于预览状态,它不能在我的系统上运行,但我设法在github上找到它的源代码.
该相关部分似乎调用
$ 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在类似的场景中使用获取访问令牌?
该错误表明您需要同意该应用程序(CLI)访问该 API(范围/资源)。
最快的方法是构建一个 CLI 同意 URL,以允许 CLI 访问您的应用程序。cli 应用程序 ID 是04b07795-8ddb-461a-bbee-02f9e1bf7b46。
像这样的东西。
https://login.microsoftonline.com/<your-tenant-name-or-id>/oauth2/v2.0/authorize?response_type=code&client_id=04b07795-8ddb-461a-bbee-02f9e1bf7b46&scope=<the scope of the target app/api>
| 归档时间: |
|
| 查看次数: |
897 次 |
| 最近记录: |