azure - 通过 ARM 生成的仪表板检索数据时出错

标签 azure azure-resource-manager

我尝试部署带有基于日志分析查询的绘图的仪表板。部署进展顺利,但结果是在仪表板上接收数据时出错。关于如何修复它有什么想法吗?

我尝试了所有生成等于手动创建的方法的方法,但在任何情况下都不起作用。唯一的区别在于 PartId 丢失的部分,但我不知道如何获取它或提供一些。硬编码或省略不起作用。喜欢

{
   "name": "PartId",
   "value": "deb07eda-e7e2-4d53-8bb0-9fb5c99306fc" 
},
{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "location": {
      "type": "string"
    },
    "Url": {
      "type": "string"
    },
    "appInsightName":{  
      "type":"string"
   },
   "namePrefix":{
     "type":"string"
   }
  },
  "variables": {
  },
  "resources": [
    {
      "properties": {
        "lenses": {
          "0": {
            "order": 0,
            "parts": {
              "0": {
                "position": {
                  "x": 9,
                  "y": 0,
                  "colSpan": 6,
                  "rowSpan": 4
                },
                "metadata": {
                  "inputs": [
                    {
                      "name": "ComponentId",
                      "value": {
                        "SubscriptionId": "[subscription().subscriptionId]",
                        "ResourceGroup": "[resourceGroup().Name]",
                        "Name": "Percent Statistics",
                        "ResourceId": "[concat(subscription().id, '/resourceGroups/', resourceGroup().Name, '/providers/microsoft.insights/components/', parameters('appInsightName'))]"
                      }
                    },
                    {
                      "name": "Query",
                      "value": "..."
                    },
                    {
                      "name": "TimeRange",
                      "value": "P1D"
                    },
                    {
                      "name": "Dimensions",
                      "value": {
                        "xAxis": {
                          "name": "name",
                          "type": "String"
                        },
                        "yAxis": [
                          {
                            "name": "any_val2",
                            "type": "Int32"
                          }
                        ],
                        "splitBy": [],
                        "aggregation": "Sum"
                      }
                    },
                    {
                      "name": "Version",
                      "value": "1.0"
                    },
                    {
                      "name": "PartTitle",
                      "value": "Analytics"
                    },
                    {
                      "name": "PartSubTitle",
                      "value": "Percentage"
                    },
                    {
                      "name": "resourceTypeMode",
                      "value": "components"
                    },
                    {
                      "name": "ControlType",
                      "value": "AnalyticsDonut"
                    }
                  ],
                  "type": "Extension/AppInsightsExtension/PartType/AnalyticsPart",
                  "asset": {
                    "idInputName": "ComponentId",
                    "type": "ApplicationInsights"
                  }
                }
              }
            }
          }
        },
        "metadata": {
          "model": {
            "timeRange": {
              "value": {
                "relative": {
                  "duration": 24,
                  "timeUnit": 1
                }
              },
              "type": "MsPortalFx.Composition.Configuration.ValueTypes.TimeRange"
            },
            "filterLocale": {
              "value": "en-us"
            },
            "filters": {
              "value": {
                "MsPortalFx_TimeRange": {
                  "model": {
                    "format": "utc",
                    "granularity": "auto",
                    "relative": "24h"
                  },
                  "displayCache": {
                    "name": "UTC Time",
                    "value": "Past 24 hours"
                  }
                }
              }
            }
          }
        }
      },
      "name": "[concat('db-', uniqueString(resourceGroup().id))]",
      "type": "Microsoft.Portal/dashboards",
      "location": "[parameters('location')]",
      "tags": {
        "hidden-title": ""
      },
      "apiVersion": "2015-08-01-preview"
    }
  ]
}

最佳答案

您可以像这样生成它,而不是硬编码 PartId:

"parameters": { 
      "dashboardName": {
          "type": "string",
          "defaultValue":  "My Custom dashboard"
      }
},

"variables": {
    "dashboardID": "[concat(uniquestring(resourceGroup().id), uniquestring(parameters('dashboardName')))]"
},
{
   "name": "PartId",
   "value": "[concat(uniquestring(variables('dashboardID')), 'Part1')]"
},

关于azure - 通过 ARM 生成的仪表板检索数据时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57794553/

相关文章:

azure - ARM 模板部署 - 逻辑应用程序到事件网格主题和多订阅调用更多逻辑应用程序

azure - 使用 ARM 模板对 Azure 存储帐户容器设置合法保留

azure - 在 ARM 模板中连接对象

Azure Synapse Polybase/外部表 - 仅返回最新文件

asp.net-mvc - 从 MVC3 迁移到 MVC4 和 Azure 1.7 - 为什么 iisexpress.exe 现在出现在日志文件中

java - 从azure sdk for java生成jar时出错

azure - Azure 资源管理器相当于 Docker 的 kubernetes

Azure 成本管理导出 : Is it possible to change the time at which an export is made

web-services - 如何使用 Azure API 管理链接 API

azure - 无法使用NotificationHub + ApnsCredentials部署arm模板