我尝试部署带有基于日志分析查询的绘图的仪表板。部署进展顺利,但结果是在仪表板上接收数据时出错。关于如何修复它有什么想法吗?
我尝试了所有生成等于手动创建的方法的方法,但在任何情况下都不起作用。唯一的区别在于 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/