Azure App Insights 到 Govcloud Stage 和 Prod 上的 API 集成
Azure App Insights to APIM integration on Gov Cloud Stage & Prod
我正在努力将应用程序部署到 Azure Gov Cloud Stage & Prod。在开发和 QA 中,我们使用 APIM 连接到 AppInsights 来收集统计数据并生成警报,但是,AppInsights 在 Stage Gov Cloud 中不可用。
是否有关于 Application Insights in Gov Cloud on Stage 可用性的官方时间表?
作为解决方法,我们计划在 Dev(比如 AI-dev)上创建一个 Application Insights 资源,该资源将与 Stage 中的 APIM(比如 APIM -阶段)。
但是,当我们想要进行关联时,我们转到 Azure 门户中的 APIM 阶段并尝试 select Application Insights 资源 - 有 none 可用,现有的 AppInsights 资源在 APIM in Stage 中看不到 Dev 和 QA。
是否可以以可见的方式配置舞台?如果是,那么如何?我们正在寻找建立这种关联的任何方法 - 手动或自动使用 API.
是否有任何其他解决方法可用于为 Stage/Prod 部署收集 application/APIM 请求统计信息?最终目标是让请求警报(例如错误请求)为 Stage/Prod.
工作
以下是我们调查后的发现:
- Microsoft 表示,在 Gov Cloud on Stage 中使用 Application Insights 的目标日期是 2018 年第四季度末 - 截至 2018 年 10 月 11 日。
2./3.
可以通过两种方式将位于 Dev(商业云)中的 Application Insights 与位于 Gov Cloud Stage 中的 APIM 相关联 - 使用 VSTS 管道任务或 REST API。事实证明,Azure 门户 GUI 仍然不会显示任何关联或在执行此操作后显示无效关联,但最终结果是它正在运行。
方法 1(已测试并有效)
VSTS 任务:
task: AzureResourceGroupDeployment@2
VSTS 任务模板:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appinsights-name": {
"type": "string"
},
"instrumentation": {
"type": "string"
},
"apim-name": {
"type": "string"
},
"api-name": {
"type": "string"
}
},
"resources": [
{
"type": "Microsoft.ApiManagement/service/loggers",
"name": "[concat(parameters('apim-name'), '/', parameters('appinsights-name'))]",
"apiVersion": "2018-01-01",
"scale": null,
"properties": {
"loggerType": "applicationInsights",
"description": null,
"credentials": {
"instrumentationKey": "[parameters('instrumentation')]"
},
"isBuffered": true
}
},
{
"type": "Microsoft.ApiManagement/service/apis/diagnostics",
"name": "[concat(parameters('apim-name'), '/', parameters('api-name'), '/', 'applicationinsights')]",
"apiVersion": "2018-01-01",
"scale": null,
"properties": {
"enabled": true
}
},
{
"type": "Microsoft.ApiManagement/service/apis/diagnostics/loggers",
"name": "[concat(parameters('apim-name'), '/', parameters('api-name'), '/', 'applicationinsights', '/',parameters('appinsights-name'))]",
"apiVersion": "2018-01-01",
"scale": null,
"properties": {
"loggerType": "applicationInsights",
"description": null,
"credentials": {
"instrumentationKey": "[parameters('instrumentation')]"
},
"isBuffered": true,
"resourceId": "[parameters('appinsights-name')]"
},
"dependsOn": [
"[resourceId('Microsoft.ApiManagement/service/apis/diagnostics', parameters('apim-name'), parameters('api-name'), 'applicationinsights')]"
]
}
]
}
方法二(未测试)
PUT https://management.usgovcloudapi.net/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{apimServiceName}/loggers/applicationinsights?api-version=2018-01-01 HTTP/1.1
Authorization: Bearer
Content-Type: application/json
{
"properties": {
"loggerType": "applicationinsights",
"description": null,
"isBuffered": true,
"resourceId": null,
"credentials":{
"instrumentationKey":"<ApplicationInsights-InstrumentationKey>"
}
}
}
PUT https://management.usgovcloudapi.net/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{apimServiceName}/diagnostics/applicationinsights?api-version=2018-01-01 HTTP/1.1
Authorization: Bearer
Content-Type: application/json
{
"properties": {
"enabled": true
}
}
我正在努力将应用程序部署到 Azure Gov Cloud Stage & Prod。在开发和 QA 中,我们使用 APIM 连接到 AppInsights 来收集统计数据并生成警报,但是,AppInsights 在 Stage Gov Cloud 中不可用。
是否有关于 Application Insights in Gov Cloud on Stage 可用性的官方时间表?
作为解决方法,我们计划在 Dev(比如 AI-dev)上创建一个 Application Insights 资源,该资源将与 Stage 中的 APIM(比如 APIM -阶段)。 但是,当我们想要进行关联时,我们转到 Azure 门户中的 APIM 阶段并尝试 select Application Insights 资源 - 有 none 可用,现有的 AppInsights 资源在 APIM in Stage 中看不到 Dev 和 QA。 是否可以以可见的方式配置舞台?如果是,那么如何?我们正在寻找建立这种关联的任何方法 - 手动或自动使用 API.
是否有任何其他解决方法可用于为 Stage/Prod 部署收集 application/APIM 请求统计信息?最终目标是让请求警报(例如错误请求)为 Stage/Prod.
工作
以下是我们调查后的发现:
- Microsoft 表示,在 Gov Cloud on Stage 中使用 Application Insights 的目标日期是 2018 年第四季度末 - 截至 2018 年 10 月 11 日。
2./3.
可以通过两种方式将位于 Dev(商业云)中的 Application Insights 与位于 Gov Cloud Stage 中的 APIM 相关联 - 使用 VSTS 管道任务或 REST API。事实证明,Azure 门户 GUI 仍然不会显示任何关联或在执行此操作后显示无效关联,但最终结果是它正在运行。
方法 1(已测试并有效)
VSTS 任务:
task: AzureResourceGroupDeployment@2
VSTS 任务模板:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appinsights-name": {
"type": "string"
},
"instrumentation": {
"type": "string"
},
"apim-name": {
"type": "string"
},
"api-name": {
"type": "string"
}
},
"resources": [
{
"type": "Microsoft.ApiManagement/service/loggers",
"name": "[concat(parameters('apim-name'), '/', parameters('appinsights-name'))]",
"apiVersion": "2018-01-01",
"scale": null,
"properties": {
"loggerType": "applicationInsights",
"description": null,
"credentials": {
"instrumentationKey": "[parameters('instrumentation')]"
},
"isBuffered": true
}
},
{
"type": "Microsoft.ApiManagement/service/apis/diagnostics",
"name": "[concat(parameters('apim-name'), '/', parameters('api-name'), '/', 'applicationinsights')]",
"apiVersion": "2018-01-01",
"scale": null,
"properties": {
"enabled": true
}
},
{
"type": "Microsoft.ApiManagement/service/apis/diagnostics/loggers",
"name": "[concat(parameters('apim-name'), '/', parameters('api-name'), '/', 'applicationinsights', '/',parameters('appinsights-name'))]",
"apiVersion": "2018-01-01",
"scale": null,
"properties": {
"loggerType": "applicationInsights",
"description": null,
"credentials": {
"instrumentationKey": "[parameters('instrumentation')]"
},
"isBuffered": true,
"resourceId": "[parameters('appinsights-name')]"
},
"dependsOn": [
"[resourceId('Microsoft.ApiManagement/service/apis/diagnostics', parameters('apim-name'), parameters('api-name'), 'applicationinsights')]"
]
}
]
}
方法二(未测试)
PUT https://management.usgovcloudapi.net/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{apimServiceName}/loggers/applicationinsights?api-version=2018-01-01 HTTP/1.1
Authorization: Bearer
Content-Type: application/json
{
"properties": {
"loggerType": "applicationinsights",
"description": null,
"isBuffered": true,
"resourceId": null,
"credentials":{
"instrumentationKey":"<ApplicationInsights-InstrumentationKey>"
}
}
}
PUT https://management.usgovcloudapi.net/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{apimServiceName}/diagnostics/applicationinsights?api-version=2018-01-01 HTTP/1.1
Authorization: Bearer
Content-Type: application/json
{
"properties": {
"enabled": true
}
}