json APIM记录器资源引用其他订阅中的AI

xxe27gdn  于 2022-12-30  发布在  其他
关注(0)|答案(1)|浏览(85)

正在尝试对API管理服务启用Application Insights。Application Insights位于另一个订阅中。参数“ApplicationInsightsInstanceRI”包含完整的资源AI ID。是否知道发生此错误的原因?

**错误:**无效的资源类型:在API版本“2019-12- 01”的命名空间“Microsoft.Insights”中找不到该资源类型。

"type": "Microsoft.ApiManagement/service/loggers",
    "name": "[concat(parameters('apiManagementServiceName'), '/', parameters('ApplicationInsightsInstanceName'))]",
    "dependsOn": ["[resourceId('Microsoft.ApiManagement/service', parameters('apiManagementServiceName'))]"],
    "apiVersion": "2018-06-01-preview",
    "properties": {
      "loggerType": "applicationInsights",
      "description": "Logger resources to APIM",
      "resourceid": "[parameters('ApplicationInsightsInstanceRI')]"
      "credentials": {
        "instrumentationKey": "[reference(resourceId('Microsoft.Insights/component', parameters('ApplicationInsightsInstanceName')), '2019-12-01', 'Full').properties.InstrumentationKey]",
iswrvxsc

iswrvxsc1#

知道为什么会出现此错误吗?
此错误是由于无效的检测键。在我的模板中直接提到检测键后,我能够得到所需的结果& API调用工作正常。

下面是对我有效的模板。

{

"type":  "Microsoft.ApiManagement/service/loggers",

"apiVersion":  "2022-04-01-preview",

"name":  "[concat(parameters('service_HelloWorld_APimanagement_name'), '/sangammigrationmetrics')]",

"dependsOn":  [

"[resourceId('Microsoft.ApiManagement/service', parameters('service_HelloWorld_APimanagement_name'))]"

],

"properties":  {

"loggerType":  "applicationInsights",

"credentials":  {

"instrumentationKey":  "{{<INSTRUMENATION_KEY>}}"

},

"isBuffered":  true,

"resourceId":  "[parameters('components_SangamMigrationMetrics_externalid')]"

}

},

相关问题