【问题标题】:AADSTS65005: Invalid resource. (Azure Time Series Insights API)AADSTS65005:资源无效。 (Azure 时序见解 API)
【发布时间】:2017-10-11 19:05:34
【问题描述】:

我正在尝试获取授权代码和令牌以访问时间序列环境。

我在 Azure Active Directory 中创建了一个应用程序,并按照 link 中的说明授予它访问时间序列环境的权限。之后,我得到了我的 client_id(应用程序 ID)、client_secret(应用程序密钥)和我的租户 ID。

然后我尝试按照此link 中的说明进行操作,并尝试在浏览器中获取资源“https://api.timeseries.azure.com/”的身份验证代码。我在浏览器中插入的地址是这样的:

https://login.microsoftonline.com/{tenant}/oauth2/authorize?client_id={client_id}&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%2F&response_mode=query&resource=https%3A%2F%2Fapi.timeseries.azure.com%2F&state=12345

我检查了三倍的值,在我看来一切都是正确的,但我的浏览器中不断出现以下错误:

AADSTS65005: Invalid resource. The client has requested access to a resource 
which is not listed in the requested permissions in the client's application 
registration. Client app ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. Resource 
value from request: https://api.timeseries.azure.com/. Resource app ID: 
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. List of valid resources from app 
registration: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

感谢您的帮助。

【问题讨论】:

  • 只是为了确保在 Azure 门户中,您是否将时间序列资源添加到您的应用权限?
  • 您好丹尼尔,感谢您的回复。在时序环境页面中,我在数据访问策略部分添加了注册的 App。在 Azure Active Directory -> 应用注册 -> 时序环境 -> 设置 -> 所需权限 -> 添加 API 访问权限 -> 选择一个 API,我没有看到任何与时序资源相关的 API。

标签: azure azure-active-directory azure-timeseries-insights


【解决方案1】:

终于发现了问题所在。我有点像 microsoft azure 的菜鸟,但终于明白了。

问题是参数资源的值是“https://api.timeseries.azure.com/”,而它应该具有我尝试访问的资源的已注册应用程序(服务主体)的应用程序 ID。

我还需要创建另一个注册应用程序作为客户端,并将我的资源的注册应用程序添加到所需权限中。我错过了这一步,因为在尝试将 API 添加到所需权限时,它没有显示我的资源的注册应用程序名称,除非我使用名称的初始字符进行过滤,如您在 https://blog.hompus.nl/2017/03/25/missing-azure-apis-when-adding-permissions-to-an-azure-ad-app/ 中看到的那样。

在这种情况下,client_id 参数应该是客户端注册的应用程序的应用程序 ID。

之后,我在浏览器中插入正确值的地址,确认访问,浏览器返回授权码。

【讨论】:

  • 在搜索框中,只需复制粘贴错误信息中显示的客户端ID,您将获得API名称,添加权限并等待10秒再次测试。谢谢,它对我有用。
猜你喜欢
  • 2018-10-06
  • 2017-03-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-21
  • 1970-01-01
  • 2014-11-19
  • 1970-01-01
相关资源
最近更新 更多