繁体   English   中英

Azure CLI 无法从模板创建门户仪表板

[英]Azure CLI unable to create portal dashboards from templates

逐字使用提供的示例 json,无论多么简单,总是会产生以下结果。 我一直无法找到有关此错误的任何文档。

PS C:\Users\X> az portal dashboard create --input-path "C:\Users\X\Downloads\test.json" --resource-group TestGroup

--name "testDash" 命令组 'portal' 是实验性的,不在客户支持范围内。 请谨慎使用。 <_io.TextIOWrapper name='C:\Users\X\Downloads\test.json' mode='r' encoding='cp1252'> 不包含属性 'lenses'

我已经反复确认该属性存在,因为它也直接从 Microsoft 自己的文档中提取, https://learn.microsoft.com/en-us/azure/azure-portal/azure-portal-dashboards-create-programmatically#从 json 创建模板

<_io.TextIOWrapper name='C:\Users\X\Downloads\test.json' mode='r' encoding='cp1252'> 不包含属性 'lenses'

根据我的测试,我可以重现同样的问题。

在此处输入图像描述

在 Json 文件中,确实存在 lenses 属性。 所以这个问题存在于 azure cli 命令本身。

我已经在Github的azure cli的反馈界面反馈过这个问题。

Azure CLI 问题

更新:

az portal dashboard create,--input-path 是属性 json 文件的路径,而不是完整模板

Azure CLI 命令: az portal dashboard create将读取properties -> lenses而不是整个模板。

为了解决这个问题,我们需要删除其他参数并保留lenses参数。

这是我的例子:

{
    "lenses": {
      "0": {
        "order": 0,
        "parts": {}
      }
    },
    "metadata": {
      "model": {
        "timeRange": {
          "value": {
            "relative": {
              "duration": 24,
              "timeUnit": 1
            }
          },
          "type": "MsPortalFx.Composition.Configuration.ValueTypes.TimeRange"
        }
      }
    }
 
}

然后它会起作用。

使用页面底部的反馈选项在 GitHub 中提交问题以寻求帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM