【问题标题】:Azure Application Insights REST APIAzure 应用程序洞察力 REST API
【发布时间】:2017-05-26 13:12:51
【问题描述】:

有没有使用 Azure API 和 Azure Active Directory 使用 Azure Application Insights REST API 的合适示例?

【问题讨论】:

  • 不确定你的意思。
  • api 文档中提到了两种方法 1. API 密钥身份验证和 2. Azure Active Directory 身份验证,但没有第二种方法的示例。我面临第一种方法的 api 速率限制问题,所以我想使用第二种方法
  • 你能给我那个文档的链接吗?

标签: node.js azure-application-insights


【解决方案1】:

在顶级页面中有使用 API 密钥和 Azure AAD 两种方式的示例:

https://dev.applicationinsights.io/documentation/Authorization

使用公共 API 格式:API 密钥认证

https://api.applicationinsights.io/{api-version}/{app-id}/{query-path}?[query-parameters]

https://dev.applicationinsights.io/documentation/Authorization/API-key-authentication

使用 Azure API 格式:用户身份验证

如果您使用的是Azure API format,那么授权是 由Azure Active Directory 完成。您可以详细了解具体 AAD authentication scenarios 如果您使用它来执行每个用户 身份验证。

有关如何使用 AAD 身份验证的有用资源是 Developer's Guide to Auth with Azure Resource Manager API,和 这个网站还有一个useful set of PowerShell cmdlets 来处理 针对 AAD 进行身份验证和通过以下方式发送 API 调用的详细信息 手臂。它们是获得一组有针对性的 Fiddler 会话的快速方法 显示通过 ARM 进行身份验证和调用我们的 API 的实际调用(对比 API 密钥直接指向 API)。

例如,这一系列 PowerShell 命令将运行 Analytics query 并转储 JSON 响应:

Connect-ARM
Execute-ARMQuery -SubscriptionId {subscription-id} -HTTPVerb GET -Base "/subscriptions/{subscription-id}/resourcegroups/{resource-group-name}/providers/microsoft.insights/components/{ai-component-name}/api/query" -APIVersion "2014-12-01-preview" -Query "&query=requests|count" | ConvertTo-Json -Depth 99

【讨论】:

  • nodejs能做到吗?我可以用邮递员之类的其他客户端测试它吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-17
  • 1970-01-01
  • 2016-09-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多