Hope sull
Hope sull

Reputation: 11

What is the error within the ARM template? Please advise

Hello I am trying to deploy this template via azure devops and get this error:

'The template resource '' of type 'microsoft.insights/workbooks' at line '1' and column '1512' is not valid. The name property cannot be null or empty. Please see https://aka.ms/arm-template/#resources for usage details.'." AdditionalInfo=[{"info":{"lineNumber":1,"linePosition":1512,"path":"properties.template.resources[0]"},"type":"TemplateViolation"}]

Template:

{
    "contentVersion": "1.0.0.0",
    "parameters": {
      "workbookDisplayName": {
        "type": "string",
        "defaultValue": "Azure Firewall Workbook",
        "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",
        "allowedValues": [
            "workbook",
            "sentinel"
            
          ],
          "defaultValue": "workbook",
        "metadata": {
          "description": "The gallery that the workbook will been shown under. Supported values include workbook, tsg, etc. Usually, this is 'workbook'"
        }
      },
      "DiagnosticsWorkspaceName": {
        "type": "string",
        "defaultValue": "WorkspaceName",
        "metadata": {
          "description": "Provide the workspace name for your Network Diagnostic logs"
        }
      },
      "DiagnosticsWorkspaceSubscription": {
        "type": "string",
        "defaultValue": "WorkspaceSubscriptionID",
        "metadata": {
          "description": "Provide the workspace subscription GUID for your Network Diagnostic logs"
        }
      },
      "DiagnosticsWorkspaceResourceGroup": {
        "type": "string",
        "defaultValue": "ResourceGroupName",
        "metadata": {
          "description": "Provide the workspace resourcegroupname for your Network Diagnostic logs"
        }
      },
      "workbookId": {
        "type": "string",
        "defaultValue": "[newGuid()]",
        "metadata": {
          "description": "The unique guid for this workbook instance"
        }
      }
    },
    "variables": {
            "workbookSourceId": "[concat('/subscriptions/',parameters('DiagnosticsWorkspaceSubscription'),'/resourcegroups/', parameters('DiagnosticsWorkspaceResourceGroup'), '/providers/Microsoft.OperationalInsights/workspaces/',parameters('DiagnosticsWorkspaceName'))]"
  },
    "resources": [
      {
        "name": "[parameters('workbookId')]",
        "type": "microsoft.insights/workbooks",
        "location": "[resourceGroup().location]",
        "apiVersion": "2018-06-17-preview",
        "dependsOn": [],
        "kind": "shared",
        "properties": {
          "displayName": "[parameters('workbookDisplayName')]"}",
          "version": "1.0",
          "sourceId": "[variables('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#"
  }

Upvotes: 0

Views: 683

Answers (1)

VenkateshDodda
VenkateshDodda

Reputation: 5496

Looks like there are some syntactical errors in the above shared ARM template .

 "properties": {
          "displayName": "[parameters('workbookDisplayName')]"}",
          "version": "1.0",
          "sourceId": "[variables('workbookSourceId')]",
          "category": "[parameters('workbookType')]"
        }

As per the Azure documentation for the Microsoft.Insights/Workbooks sourceID,Category & Version are the parameters of the properties block.

When we have loaded the above shared Json template/ARM template in our VisualStudioCode,the intellisense has found few syntactical errors & also thrown error stating serializedData parameter is mandatory in the properities block of Microsoft.Insights/Workbooks.

Here is the ARM template post fixing those errors & tried deploying in our local environment which got successfully deployed without any issues.

{
    "contentVersion": "1.0.0.0",
    "parameters": {
      "workbookDisplayName": {
        "type": "string",
        "defaultValue": "Azure Firewall Workbook",
        "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",
        "allowedValues": [
            "workbook",
            "sentinel"
            
          ],
          "defaultValue": "workbook",
        "metadata": {
          "description": "The gallery that the workbook will been shown under. Supported values include workbook, tsg, etc. Usually, this is 'workbook'"
        }
      },
      "DiagnosticsWorkspaceName": {
        "type": "string",
        "defaultValue": "WorkspaceName",
        "metadata": {
          "description": "Provide the workspace name for your Network Diagnostic logs"
        }
      },
      "DiagnosticsWorkspaceSubscription": {
        "type": "string",
        "defaultValue": "WorkspaceSubscriptionID",
        "metadata": {
          "description": "Provide the workspace subscription GUID for your Network Diagnostic logs"
        }
      },
      "DiagnosticsWorkspaceResourceGroup": {
        "type": "string",
        "defaultValue": "ResourceGroupName",
        "metadata": {
          "description": "Provide the workspace resourcegroupname for your Network Diagnostic logs"
        }
      },
      "workbookId": {
        "type": "string",
        "defaultValue": "[newGuid()]",
        "metadata": {
          "description": "The unique guid for this workbook instance"
        }
      }
    },
    "variables": {
            "workbookSourceId": "[concat('/subscriptions/',parameters('DiagnosticsWorkspaceSubscription'),'/resourcegroups/', parameters('DiagnosticsWorkspaceResourceGroup'), '/providers/Microsoft.OperationalInsights/workspaces/',parameters('DiagnosticsWorkspaceName'))]"
  },
    "resources": [
      {
        "name": "[parameters('workbookId')]",
        "type": "microsoft.insights/workbooks",
        "location": "[resourceGroup().location]",
        "apiVersion": "2018-06-17-preview",
        "dependsOn": [],
        "kind": "shared",
        "properties" : {
        "displayName": "[parameters('workbookDisplayName')]",
          "sourceId": "[variables('workbookSourceId')]",
          "category": "[parameters('workbookType')]",
            "serializedData" : "",
            "version" : "1.0"
        }
      }
    ],
    "outputs": {
      "workbookId": {
        "type": "string",
        "value": "[resourceId( 'microsoft.insights/workbooks', parameters('workbookId'))]"
      }
    },
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"
}

Note: In the above shared template, we observed that the schema version in the deployment template you are using is 2015-01-01 its always suggested to use latest version 2019-04-01

Here is the output sample for our reference:

enter image description here

Upvotes: 1

Related Questions