Azure workbook deployment fails with "sharedType cannot be null"

42 Views Asked by At

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

There are 1 best solutions below

0
John Gardner On BEST ANSWER

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.