【问题标题】:Insufficient Permissions with Access Token to Azure Data CatalogAzure 数据目录的访问令牌权限不足
【发布时间】:2019-12-03 00:57:58
【问题描述】:

我正在尝试使用客户端密钥向 Azure 数据目录发出 API 调用,但是我收到了 Permission denied 错误。

我能够创建令牌,并且在 AAD 中为客户端应用程序授予了必要的权限。

如果我将身份验证方法更改为在用户登录时使用委托访问,它可以工作,但如果我尝试使用客户端密码,则生成的令牌没有适当的权限。

这是我使用各种示例更改的一些代码

此代码中的令牌有效

//get the token

authResult = await authContext.AcquireTokenAsync(resourceUri, clientId, new Uri(redirectUri), new PlatformParameters(PromptBehavior.Always));

//the token from this code doesn't work

IConfidentialClientApplication app;

app = ConfidentialClientApplicationBuilder.Create(clientId)
                .WithClientSecret(clientSecret)
                .WithAuthority(new Uri(authorityuri))
                .Build();

string[] scopes = new string[] { "https://api.azuredatacatalog.com/.default" };

result = await app.AcquireTokenForClient(scopes);

我收到此错误远程服务器返回错误:

(403) AccessDenied : 拒绝访问..

【问题讨论】:

    标签: authentication token access-token azure-data-catalog


    【解决方案1】:

    以下是配置服务主体配置以支持 ADC REST API 的高级步骤

    • Azure 活动目录 |应用程序注册 – 为应用程序类型选择 Web 应用程序/API,URL 可以是任何内容示例:http://portal.azure.com
    • 选择应用程序 |所需权限 |添加 Microsoft Azure 数据目录
    • 导航到http://www.azuredatacatalog.com |设置 - 根据您可以添加到词汇表管理员/目录管理员的业务需求,将服务主体添加到目录用户。格式为clientid@tenantid

    ****Clientid = Azure Active Directory |应用注册 |应用程序 ID**

    **TenantID = Azure Active Directory |属性 |目录 ID****

    【讨论】:

      猜你喜欢
      • 2015-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-03
      • 1970-01-01
      • 2019-12-19
      • 2012-07-24
      相关资源
      最近更新 更多