Azure工作簿部署失败,显示“sharedType不能为null”。

huangapple go评论68阅读模式
英文:

Azure workbook deployment fails with "sharedType cannot be null"

问题

我正在尝试在Azure中部署一个工作簿,但一直出现这个错误:

"DeploymentFailed"错误代码,至少有一个资源部署操作失败。请列出详细的部署操作。请参阅 https://aka.ms/arm-deployment-operations 以获取使用详细信息。

"BadRequest"错误代码,数值不能为空。参数名称:sharedType。

关于sharedType是什么意思?我在Azure文档中没有找到相关信息:

https://learn.microsoft.com/en-us/search/?terms=sharedType&scope=Azure&fromNavSearch=true

我还在搜索引擎上搜索了这个错误,但没有找到有用的信息。是否有人之前遇到过相同的错误?
在Azure文档中是否有关于sharedType的遗漏信息?

英文:

I'm trying to deploy a workbook in azure but keep getting this error:

{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":\[{"code":"BadRequest","message":"Value cannot be null.\\r\\nParameter name: sharedType"}\]}

What does sharedType mean? I didn't find anything related in the azure docs

https://learn.microsoft.com/en-us/search/?terms=sharedType&scope=Azure&fromNavSearch=true

and also googled the error but couldn't find anything useful. Did someone have the same error before?
Is there anything in the azure docs I missed about sharedType?

答案1

得分: 1

您在执行此操作时使用的是哪个API版本?您是要发布到 microsoft.insights/workbooks 还是 microsoft.insights/myworkbooks(不再支持)?

workbooks 以前有 "private" 和 "shared" 的概念,所以您不应该再设置这个字段(或者很长时间没有设置了?)。您的模板中是否缺少 'kind' 字段?

kind: "shared" 应该是正确的选择。

我刚刚使用了这个模板:

{
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workbookDisplayName": {
      "type": "string",
      "defaultValue": "Workbook 12332160",
      "metadata": {
        "description": "The friendly name for the workbook that is used in the Gallery or Saved List.  This name must be unique within a resource group."
      }
    },
    "workbookType": {
      "type": "string",
      "defaultValue": "workbook",
      "metadata": {
        "description": "The gallery that the workbook will be shown under. Supported values include workbook, tsg, etc. Usually, this is 'workbook'"
      }
    },
    "workbookSourceId": {
      "type": "string",
      "defaultValue": "Azure Monitor",
      "metadata": {
        "description": "The id of resource instance to which the workbook will be associated"
      }
    },
    "workbookId": {
      "type": "string",
      "defaultValue": "[newGuid()]",
      "metadata": {
        "description": "The unique guid for this workbook instance"
      }
    }
  },
  "resources": [
    {
      "name": "[parameters('workbookId')]",
      "type": "microsoft.insights/workbooks",
      "location": "[resourceGroup().location]",
      "apiVersion": "2022-04-01",
      "dependsOn": [],
      "kind": "shared",
      "properties": {
        "displayName": "[parameters('workbookDisplayName')]",
        "serializedData": "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":{\"json\":\"# test\"},\"name\":\"text - 0\"}],\"isLocked\":false,\"fallbackResourceIds\":[\"Azure Monitor\"]}",
        "version": "1.0",
        "sourceId": "[parameters('workbookSourceId')]",
        "category": "[parameters('workbookType')]"
      }
    }
  ],
  "outputs": {
    "workbookId": {
      "type": "string",
      "value": "[resourceId( 'microsoft.insights/workbooks', parameters('workbookId'))]"
    }
  },
  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"
}

此模板中没有包含 sharedType,但在 Azure 门户内部它是有 'kind' 字段的,并且成功完成了操作。

英文:

what api version are you using when you do this? are you posting to microsoft.insights/workbooks or microsoft.insights/myworkbooks (no longer supported)

workbooks used to have concept of "private" and "shared", so you shouldn't have to set this anymore (or for a long time?). are you missing the 'kind' field in your template?

kind: "shared" would be the way to go.

i just used this template:

{
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workbookDisplayName": {
      "type": "string",
      "defaultValue": "Workbook 12332160",
      "metadata": {
        "description": "The friendly name for the workbook that is used in the Gallery or Saved List.  This name must be unique within a resource group."
      }
    },
    "workbookType": {
      "type": "string",
      "defaultValue": "workbook",
      "metadata": {
        "description": "The gallery that the workbook will been shown under. Supported values include workbook, tsg, etc. Usually, this is 'workbook'"
      }
    },
    "workbookSourceId": {
      "type": "string",
      "defaultValue": "Azure Monitor",
      "metadata": {
        "description": "The id of resource instance to which the workbook will be associated"
      }
    },
    "workbookId": {
      "type": "string",
      "defaultValue": "[newGuid()]",
      "metadata": {
        "description": "The unique guid for this workbook instance"
      }
    }
  },
  "resources": [
    {
      "name": "[parameters('workbookId')]",
      "type": "microsoft.insights/workbooks",
      "location": "[resourceGroup().location]",
      "apiVersion": "2022-04-01",
      "dependsOn": [],
      "kind": "shared",
      "properties": {
        "displayName": "[parameters('workbookDisplayName')]",
        "serializedData": "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":{\"json\":\"# test\"},\"name\":\"text - 0\"}],\"isLocked\":false,\"fallbackResourceIds\":[\"Azure Monitor\"]}",
        "version": "1.0",
        "sourceId": "[parameters('workbookSourceId')]",
        "category": "[parameters('workbookType')]"
      }
    }
  ],
  "outputs": {
    "workbookId": {
      "type": "string",
      "value": "[resourceId( 'microsoft.insights/workbooks', parameters('workbookId'))]"
    }
  },
  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"
}

which does not have sharedType but does have 'kind' in it from inside the azure portal and it completed successfully.

huangapple
  • 本文由 发表于 2023年7月17日 22:09:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76705291.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定