使用 REST API 创建 Azure App Insights 失败需要 ROLE
Creating Azure App Insights using REST API fails requires ROLE
我正在为 App Insight 生成 API 密钥。我正在使用 URL
“https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft。Insights/components/{resourceName}/ApiKeys”
我没有任何明确的文档,我从 MS SDK 中找到了这个:
https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/applicationinsights/Microsoft.Azure.Management.ApplicationInsights/src/Generated/APIKeysOperations.cs
但是,当我尝试通过提及 "name" 生成时,响应出现错误:
{
"code": "The API Key needs to have a Role",
"message": "The API Key needs to have a Role",
"innererror": {
"diagnosticcontext": "e1f66da1-9247-459e-a519-6426fa1449d1",
"time": "2019-09-20T07:48:20.2634617Z"
}
}
我的POST正文如下:
{
"name": "asimplekeyname"
}
如果有人使用过这个特定的 API,请帮助。
您需要在正文中包含以下属性。
{
"name":"test3",
"linkedReadProperties":[
"/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/microsoft.insights/components/<appinsight-name>/api",
"/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/microsoft.insights/components/<appinsight-name>/agentconfig"
],
"linkedWriteProperties":[
"/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/microsoft.insights/components/<appinsight-name>/annotations"
]
}
这三个属性对应于门户 -> 您的应用洞察力 -> API Access
-> Create API key
中的属性。
api - Read telemetry
agentconfig - Authenticate SDK control channel
annotations - Write annotations
您需要select至少其中一项,包含在请求正文中。
例如,您只select下面的第一个。
正文应该是:
{
"name":"test3",
"linkedReadProperties":[
"/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/microsoft.insights/components/<appinsight-name>/api"
],
"linkedWriteProperties":[]
}
我正在为 App Insight 生成 API 密钥。我正在使用 URL “https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft。Insights/components/{resourceName}/ApiKeys”
我没有任何明确的文档,我从 MS SDK 中找到了这个: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/applicationinsights/Microsoft.Azure.Management.ApplicationInsights/src/Generated/APIKeysOperations.cs
但是,当我尝试通过提及 "name" 生成时,响应出现错误:
{
"code": "The API Key needs to have a Role",
"message": "The API Key needs to have a Role",
"innererror": {
"diagnosticcontext": "e1f66da1-9247-459e-a519-6426fa1449d1",
"time": "2019-09-20T07:48:20.2634617Z"
}
}
我的POST正文如下:
{
"name": "asimplekeyname"
}
如果有人使用过这个特定的 API,请帮助。
您需要在正文中包含以下属性。
{
"name":"test3",
"linkedReadProperties":[
"/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/microsoft.insights/components/<appinsight-name>/api",
"/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/microsoft.insights/components/<appinsight-name>/agentconfig"
],
"linkedWriteProperties":[
"/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/microsoft.insights/components/<appinsight-name>/annotations"
]
}
这三个属性对应于门户 -> 您的应用洞察力 -> API Access
-> Create API key
中的属性。
api - Read telemetry
agentconfig - Authenticate SDK control channel
annotations - Write annotations
您需要select至少其中一项,包含在请求正文中。
例如,您只select下面的第一个。
正文应该是:
{
"name":"test3",
"linkedReadProperties":[
"/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/microsoft.insights/components/<appinsight-name>/api"
],
"linkedWriteProperties":[]
}