Azure应用程序洞察REST API

是否有适当的示例使用Azure API和Azure Active Directory来使用Azure Application Insights REST API?

在顶层页面中有两种方式使用API​​键和Azure AAD的示例:

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

使用公共API格式:API密钥authentication

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

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

使用Azure API格式:用户authentication

如果您使用的是Azure API格式 ,则授权由Azure Active Directory完成 。 如果您使用此function执行每用户身份validation,则可以了解有关特定AAD身份validationscheme的更多信息。

有关如何使用AAD身份validation的有用资源是“使用Azure资源pipe理器API进行身份validation的开发人员指南” ,此站点还具有一组有用的PowerShell cmdlet,用于处理AAD身份validation和通过ARM发送API调用的详细信息。 他们是一个快速的方法来获得一个有针对性的Fiddler会话集,显示实际的调用通过ARM进行身份validation和调用我们的API(API API直接指向API)。

例如,这个PowerShell命令序列将运行一个Analytics(分析)查询并转储出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