Creating Dashboard using Kusto query in ARM Template format

Sachin Kalia 26 Reputation points
2021-05-02T06:47:25.287+00:00

Hope you all are doing good. I've working on Kusto query which runs against Azure Kubernetes cluster. it works fine though when i try to incorporate within ARM template to create dashboard it throws me an error related to "expected token 'RightParenthesis' and actual 'Identifier'".

Running query in log analytic workspace is given below

let clusterName = 'AKS';
Perf
| where TimeGenerated > ago(2m)
| where ObjectName == "K8SNode"
| where CounterName == "cpuAllocatableNanoCores"
| where InstanceName contains clusterName
| summarize arg_max(TimeGenerated, *) by Computer
| summarize TotalCores=sum(CounterValue), x="join"
| join kind = inner (
KubePodInventory
| where TimeGenerated > ago(2m)
| where ClusterName contains clusterName
| summarize arg_max(TimeGenerated, *) by ContainerName
| project Name, ContainerName, Namespace
| join kind = inner (
Perf
| where TimeGenerated > ago(2m)
| where ObjectName == 'K8SContainer'
| where CounterName == 'cpuUsageNanoCores'
| where InstanceName contains clusterName
| extend ContainerNameParts = split(InstanceName, '/')
| extend ContainerNamePartCount = array_length(ContainerNameParts)
| extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1
| extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])
| summarize arg_max(TimeGenerated, *) by ContainerName
| project ContainerName, CounterValue
)
on ContainerName
| project Name, Namespace, CounterValue
| summarize CoresPerNamespace=sum(CounterValue) by Namespace, x="join"
)
on x
| project UtcTime=now(), Namespace, CpuUtilizationPerNamespace=(CoresPerNamespace / TotalCores) * 100

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Later i tried to incorporate this with in ARM template and it throws an error.

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"dashboardName": {
"defaultValue": "AKS-Temp-Dashboard",
"type": "String",
"metadata": {
"description": "DASHBOARD name for Azure kubernetes service cluster"
}
},
"resourceGroupName": {
"defaultValue": "aks-rg",
"type": "String",
"metadata": {
"description": "Azure resourceGroup name for Azure kubernetes service cluster"
}
},
"aksClusterName": {
"defaultValue": "aks",
"type": "String",
"metadata": {
"description": "Azure kubernetes service cluster name"
}
}
},
"variables": {
"dashboardName": "[concat(parameters('dashboardName'), '-DASHBOARD')]",
"aksResourceId": "[resourceId(parameters('resourceGroupName') , 'Microsoft.ContainerService/managedClusters', parameters('aksClusterName'))]"
},
"resources": [
{
"properties": {
"lenses": {
"0": {
"order": 0,
"parts": {
"1": {
"position": {
"x": 0,
"y": 3,
"colSpan": 5,
"rowSpan": 3
},
"metadata": {
"inputs": [
{
"name": "resourceTypeMode",
"isOptional": true
},
{
"name": "ComponentId",
"isOptional": true
},
{
"name": "Scope",
"value": {
"resourceIds": [
"/subscriptions/7777t-a1ae-4ca9-89bc-gfgf7577575/resourcegroups/rg-eus/providers/microsoft.operationalinsights/workspaces/aks""
]
},
"isOptional": true
},
{
"name": "PartId",
"value": "4ae7fd78-1a4f-4025-a091-7d57e08d6822",
"isOptional": true
},
{
"name": "Version",
"value": "2.0",
"isOptional": true
},
{
"name": "TimeRange",
"isOptional": true
},
{
"name": "DashboardId",
"isOptional": true
},
{
"name": "DraftRequestParameters",
"isOptional": true
},
{
"name": "Query",
"value": "[concat('let clustername = \"', parameters('aksClusterName'), '\"; Perf\n| where TimeGenerated > ago(2m)\n| where ObjectName == \"K8SNode\" \n| where CounterName == \"cpuAllocatableNanoCores\" \n| where InstanceName contains clusterName\n| summarize arg_max(TimeGenerated, *) by Computer\n| summarize TotalCores=sum(CounterValue), x=\"join\"\n| join kind = inner (\n KubePodInventory\n | where TimeGenerated > ago(2m)\n | where ClusterName contains clusterName\n | summarize arg_max(TimeGenerated, *) by ContainerName\n | project Name, ContainerName, Namespace\n | join kind = inner (\n Perf\n | where TimeGenerated > ago(2m)\n | where ObjectName == 'K8SContainer'\n | where CounterName == 'cpuUsageNanoCores'\n | where InstanceName contains clusterName\n | extend ContainerNameParts = split(InstanceName, '/')\n | extend ContainerNamePartCount = array_length(ContainerNameParts) \n | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])\n | summarize arg_max(TimeGenerated, *) by ContainerName\n | project ContainerName, CounterValue\n )\n on ContainerName\n | project Name, Namespace, CounterValue\n | summarize CoresPerNamespace=sum(CounterValue) by Namespace, x=\"join\"\n )\n on x\n| project UtcTime=now(), Namespace, CpuUtilizationPerNamespace=(CoresPerNamespace / TotalCores) * 100\n\n ')]",

                  "isOptional": true  
                },  
                {  
                  "name": "ControlType",  
                  "value": "FrameControlChart",  
                  "isOptional": true  
                },  
                {  
                  "name": "SpecificChart",  
                  "value": "StackedColumn",  
                  "isOptional": true  
                },  
                {  
                  "name": "PartTitle",  
                  "value": "Analytics",  
                  "isOptional": true  
                },  
                {  
                  "name": "PartSubTitle",  
                  "value": "gaks-la1",  
                  "isOptional": true  
                },  
                {  
                  "name": "Dimensions",  
                  "value": {  
                    "xAxis": {  
                      "name": "UtcTime",  
                      "type": "datetime"  
                    },  
                    "yAxis": [  
                      {  
                        "name": "CpuUtilizationPerNamespace",  
                        "type": "real"  
                      }  
                    ],  
                    "splitBy": [  
                      {  
                        "name": "Namespace",  
                        "type": "string"  
                      }  
                    ],  
                    "aggregation": "Sum"  
                  },  
                  "isOptional": true  
                },  
                {  
                  "name": "LegendOptions",  
                  "value": {  
                    "isEnabled": true,  
                    "position": "Bottom"  
                  },  
                  "isOptional": true  
                },  
                {  
                  "name": "IsQueryContainTimeRange",  
                  "value": true,  
                  "isOptional": true  
                }  
              ],  
              "type": "Extension/Microsoft_OperationsManagementSuite_Workspace/PartType/LogsDashboardPart",  
              "settings": {}  
            }  
          }  
        }  
      }  
    },  
    "metadata": {  
      "model": {}  
    }  
  },  
  "name": "[variables('dashboardName')]",  
  "type": "Microsoft.Portal/dashboards",  
  "location": "[resourceGroup().location]",  
  "tags": {  
    "hidden-title": "AKS-Monitoring-Dashboard"  
  },  
  "apiVersion": "2015-08-01-preview"  
}  

]
}

Kindly assist me to sort out this issue. NOTE: TO me it looks concat() function generating an issue.

Find an error screenshot below:

93110-image.png

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
{count} votes

Answer accepted by question author
  1. SwathiDhanwada-MSFT 19,073 Reputation points Moderator
    2021-05-07T10:55:08.123+00:00

    @Sachin Kalia I have made few changes to the ARM template . Kindly try below template and revert if you are facing the issue.

    {  
      "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",  
      "contentVersion": "1.0.0.0",  
      "parameters": {  
        "dashboardName": {  
          "defaultValue": "AKS-Temp-Dashboard",  
          "type": "String",  
          "metadata": {  
            "description": "DASHBOARD name for Azure kubernetes service cluster"  
          }  
        },  
        "resourceGroupName": {  
          "defaultValue": "aks-rg",  
          "type": "String",  
          "metadata": {  
            "description": "Azure resourceGroup name for Azure kubernetes service cluster"  
          }  
        },  
        "aksClusterName": {  
          "defaultValue": "aks",  
          "type": "String",  
          "metadata": {  
            "description": "Azure kubernetes service cluster name"  
          }  
        }  
      },  
      "variables": {  
        "dashboardName": "[concat(parameters('dashboardName'), '-DASHBOARD')]",  
        "aksResourceId": "[resourceId(parameters('resourceGroupName') , 'Microsoft.ContainerService/managedClusters', parameters('aksClusterName'))]",  
        "query": "Perf| where TimeGenerated > ago(2m)| where ObjectName == 'K8SNode'| where CounterName == 'cpuAllocatableNanoCores'| where InstanceName contains clusterName| summarize arg_max(TimeGenerated, * ) by Computer| summarize TotalCores=sum(CounterValue), x='join'| join kind = inner (KubePodInventory| where TimeGenerated > ago(2m)| where ClusterName contains clusterName| summarize arg_max(TimeGenerated, * ) by ContainerName| project Name, ContainerName, Namespace| join kind = inner (Perf| where TimeGenerated > ago(2m)| where ObjectName == 'K8SContainer'| where CounterName == 'cpuUsageNanoCores'| where InstanceName contains clusterName| extend ContainerNameParts = split(InstanceName, '/')| extend ContainerNamePartCount = array_length(ContainerNameParts)| extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1| extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], '/', ContainerNameParts[ContainerNameIndex])| summarize arg_max(TimeGenerated, * ) by ContainerName| project ContainerName, CounterValue)on ContainerName| project Name, Namespace, CounterValue| summarize CoresPerNamespace=sum(CounterValue) by Namespace, x='join')on x| project UtcTime=now(), Namespace, CpuUtilizationPerNamespace=(CoresPerNamespace / TotalCores) *100",  
        "query1": "concat( 'let clusterName = \\'', parameters('aksClusterName') , '\\'', ';')"  
      
      },  
      "resources": [  
        {  
          "properties": {  
            "lenses": {  
              "0": {  
                "order": 0,  
                "parts": {  
                  "1": {  
                    "position": {  
                      "x": 0,  
                      "y": 3,  
                      "colSpan": 5,  
                      "rowSpan": 3  
                    },  
                    "metadata": {  
                      "inputs": [  
                        {  
                          "name": "resourceTypeMode",  
                          "isOptional": true  
                        },  
                        {  
                          "name": "ComponentId",  
                          "isOptional": true  
                        },  
                        {  
                          "name": "Scope",  
                          "value": {  
                            "resourceIds": [  
                              "/subscriptions/7777t-a1ae-4ca9-89bc-gfgf7577575/resourcegroups/rg-eus/providers/microsoft.operationalinsights/workspaces/aks"  
                            ]  
                          },  
                          "isOptional": true  
                        },  
                        {  
                          "name": "PartId",  
                          "value": "4ae7fd78-1a4f-4025-a091-7d57e08d6822",  
                          "isOptional": true  
                        },  
                        {  
                          "name": "Version",  
                          "value": "2.0",  
                          "isOptional": true  
                        },  
                        {  
                          "name": "TimeRange",  
                          "isOptional": true  
                        },  
                        {  
                          "name": "DashboardId",  
                          "isOptional": true  
                        },  
                        {  
                          "name": "DraftRequestParameters",  
                          "isOptional": true  
                        },  
                        {  
                          "name": "Query",  
                          "value": "[concat(variables('query'),variables('query1'))]",  
                          "Optional": true  
                        },  
                        {  
                          "name": "ControlType",  
                          "value": "FrameControlChart",  
                          "isOptional": true  
                        },  
                        {  
                          "name": "SpecificChart",  
                          "value": "StackedColumn",  
                          "isOptional": true  
                        },  
                        {  
                          "name": "PartTitle",  
                          "value": "Analytics",  
                          "isOptional": true  
                        },  
                        {  
                          "name": "PartSubTitle",  
                          "value": "gaks-la1",  
                          "isOptional": true  
                        },  
                        {  
                          "name": "Dimensions",  
                          "value": {  
                            "xAxis": {  
                              "name": "UtcTime",  
                              "type": "datetime"  
                            },  
                            "yAxis": [  
                              {  
                                "name": "CpuUtilizationPerNamespace",  
                                "type": "real"  
                              }  
                            ],  
                            "splitBy": [  
                              {  
                                "name": "Namespace",  
                                "type": "string"  
                              }  
                            ],  
                            "aggregation": "Sum"  
                          },  
                          "isOptional": true  
                        },  
                        {  
                          "name": "LegendOptions",  
                          "value": {  
                            "isEnabled": true,  
                            "position": "Bottom"  
                          },  
                          "isOptional": true  
                        },  
                        {  
                          "name": "IsQueryContainTimeRange",  
                          "value": true,  
                          "isOptional": true  
                        }  
                      ],  
                      "type": "Extension/Microsoft_OperationsManagementSuite_Workspace/PartType/LogsDashboardPart",  
                      "settings": {}  
                    }  
                  }  
                }  
              }  
            },  
            "metadata": {  
              "model": {}  
            }  
          },  
          "name": "[ variables('dashboardName') ]",  
          "type": "Microsoft.Portal/dashboards",  
          "location": "[ resourceGroup().location ]",  
          "tags": {  
            "hidden-title": "AKS-Monitoring-Dashboard"  
          },  
          "apiVersion": "2015-08-01-preview"  
        }  
      ]  
    }  
    
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Sachin Kalia 26 Reputation points
    2021-05-11T11:43:38.283+00:00

    Thanks
    SwathiDhanwada-MSFT for taking this into consideration.
    Since i've trying various approaches to fix this issue and found that Kusto requires special extra character in order to fit into ARM Templates.

    Here is the sample query which shows how does it look like if it should be ARM compatible to create a dashboard.

    {
                      "name": "Query",
                      "value": "[concat('let clustername = \"', parameters('aksClusterName'), '\"; KubePodInventory\n| where TimeGenerated > ago(2m)\n| where ClusterName contains clustername \n| summarize arg_max(TimeGenerated, *) by ContainerName\n| project Name, ContainerName\n| join kind = inner (\n    Perf\n    | where TimeGenerated > ago(2m)\n    | where ObjectName == ''K8SContainer''\n    | where CounterName == ''memoryLimitBytes''\n    | where InstanceName contains clustername \n    | extend ContainerNameParts = split(InstanceName, ''/'')\n    | extend ContainerNamePartCount = array_length(ContainerNameParts)            \n    | extend PodUIDIndex = ContainerNamePartCount - 2, ContainerNameIndex = ContainerNamePartCount - 1 \n    | extend ContainerName = strcat(ContainerNameParts[PodUIDIndex], ''/'', ContainerNameParts[ContainerNameIndex])\n    | summarize arg_max(TimeGenerated, *) by ContainerName\n    | project ContainerName, MemLimit=(CounterValue/1000000)\n) on ContainerName\n| order by Name asc\n| project Name, MemLimitInMB=MemLimit\n')]",
                      "isOptional": true
                    }
    

    Each parameter/hardcode value should be in such form ''/'' at various places.
    Though i deeply thankful to you for answering.

    1 person found this answer helpful.
    0 comments No comments

  2. Aakansha Verma 1 Reputation point
    2022-04-20T12:32:20.68+00:00

    @Sachin Kalia / @SwathiDhanwada-MSFT - I tried this solution provided by you above. But its not working for me.

    I'm trying to create a workbook in App insight and have a ARM template for it, it have the KQL queries also. I want to parameterized it, specifically some parameters in my kql query. Using the above approve i also used concat function, but its not working for me. Below is my code.

    {  
        "contentVersion": "1.0.0.0",  
        "parameters": {  
          "workbookDisplayName": {  
            "type": "string",  
            "defaultValue": "x1",  
            "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": "x2",  
            "metadata": {  
              "description": "Name of the app insight"  
            }  
          },  
          "workbookId": {  
            "type": "string",  
            "defaultValue": "[newGuid()]",  
            "metadata": {  
              "description": "The unique guid for this workbook instance"  
            }  
          },  
          "subscriptionId": {  
            "type": "string",  
            "defaultValue": "x3",  
            "metadata": {  
              "description": "Subscription id where the app insight resides"  
            }  
          },  
          "resourceGroupName": {  
            "type": "string",  
            "defaultValue": "x4",  
            "metadata": {  
              "description": "resource Group Name where the app insight resides"  
            }  
          },  
          "cloud_roleName": {  
            "type": "string",  
            "defaultValue": "x5",  
            "metadata": {  
              "description": "cloud_RoleName"  
            }  
          }  
        },  
        "variables": {   
          "workbookContent": {  
            "version": "Notebook/1.0",  
            "items": [  
    		  {  
                "type": 9,  
                "content": {  
                  "version": "KqlParameterItem/1.0",  
                  "parameters": [  
                    {  
                        
                      "version": "KqlParameterItem/1.0",  
                      "name": "Apps",  
                      "type": 5,  
                      "isRequired": true,  
                      "multiSelect": true,  
                      "quote": "'",  
                      "delimiter": ",",  
                      "typeSettings": {  
                        "resourceTypeFilter": {  
                          "microsoft.insights/components": true  
                        },  
                        "additionalResourceOptions": [  
                          "value::all",  
                          "value::3"  
                        ]  
                      },  
                      "value": [  
                        "value::3"  
                      ]  
                    },  
                    {  
                       
                      "version": "KqlParameterItem/1.0",  
                      "name": "TimeRange",  
                      "type": 4,  
                      "typeSettings": {  
                        "selectableValues": [  
                          {  
                            "durationMs": 300000,  
                            "createdTime": "2018-08-06T23:52:38.870Z",  
                            "isInitialTime": false,  
                            "grain": 1,  
                            "useDashboardTimeRange": false  
                          },  
                          {  
                            "durationMs": 900000,  
                            "createdTime": "2018-08-06T23:52:38.871Z",  
                            "isInitialTime": false,  
                            "grain": 1,  
                            "useDashboardTimeRange": false  
                          },  
                          {  
                            "durationMs": 1800000,  
                            "createdTime": "2018-08-06T23:52:38.871Z",  
                            "isInitialTime": false,  
                            "grain": 1,  
                            "useDashboardTimeRange": false  
                          },  
                          {  
                            "durationMs": 3600000,  
                            "createdTime": "2018-08-06T23:52:38.871Z",  
                            "isInitialTime": false,  
                            "grain": 1,  
                            "useDashboardTimeRange": false  
                          },  
                          {  
                            "durationMs": 14400000,  
                            "createdTime": "2018-08-06T23:52:38.871Z",  
                            "isInitialTime": false,  
                            "grain": 1,  
                            "useDashboardTimeRange": false  
                          },  
                          {  
                            "durationMs": 43200000,  
                            "createdTime": "2018-08-06T23:52:38.871Z",  
                            "isInitialTime": false,  
                            "grain": 1,  
                            "useDashboardTimeRange": false  
                          },  
                          {  
                            "durationMs": 86400000,  
                            "createdTime": "2018-08-06T23:52:38.871Z",  
                            "isInitialTime": false,  
                            "grain": 1,  
                            "useDashboardTimeRange": false  
                          },  
                          {  
                            "durationMs": 172800000,  
                            "createdTime": "2018-08-06T23:52:38.871Z",  
                            "isInitialTime": false,  
                            "grain": 1,  
                            "useDashboardTimeRange": false  
                          },  
                          {  
                            "durationMs": 259200000,  
                            "createdTime": "2018-08-06T23:52:38.871Z",  
                            "isInitialTime": false,  
                            "grain": 1,  
                            "useDashboardTimeRange": false  
                          },  
                          {  
                            "durationMs": 604800000,  
                            "createdTime": "2018-08-06T23:52:38.871Z",  
                            "isInitialTime": false,  
                            "grain": 1,  
                            "useDashboardTimeRange": false  
                          }  
                        ],  
                        "allowCustom": null  
                      },  
                      "value": {  
                        "durationMs": 14400000  
                      }  
                    },  
                    {  
                       
                      "version": "KqlParameterItem/1.0",  
                      "name": "Operation",  
                      "type": 1,  
                      "isHiddenWhenLocked": true,  
                      "value": "{\"App\":\"\",\"Operation\":\"\"}"  
                    },  
                    {  
                        
                      "version": "KqlParameterItem/1.0",  
                      "name": "Columns",  
                      "type": 2,  
                      "isRequired": true,  
                      "multiSelect": true,  
                      "quote": "",  
                      "delimiter": ",",  
                      "jsonData": "[[\"Mean\", \"Median\", \"p80\", \"p95\", \"p99\", \"Count\", \"Users\"]",  
                      "value": [  
                        "Mean",  
                        "Median",  
                        "p95",  
                        "Count"  
                      ]  
                    },  
                    {  
                        
                      "version": "KqlParameterItem/1.0",  
                      "name": "In",  
                      "type": 2,  
                      "multiSelect": true,  
                      "quote": "'",  
                      "delimiter": ",",  
                      "query": "[concat('let cloud_RoleName = \"', parameters('cloud_oleName'), '\"; requests\r\n| where timestamp >= ago(7d)\r\n| where cloud_RoleName == 'Placements'\r\n| summarize Count = count() by operation_Name\r\n| order by Count desc\r\n| project v = operation_Name, t = operation_Name, s = false\r\n| union (datatable(v:string, t:string, s:boolean)[\r\n'*', 'All Operations', true\r\n]))]",  
                      "typeSettings": {  
                        "additionalResourceOptions": []  
                      },  
                      "queryType": 0,  
                      "resourceType": "microsoft.insights/components"  
                    }  
                  ],  
                  "style": "pills",  
                  "queryType": 0,  
                  "resourceType": "microsoft.insights/components"  
                },  
                "name": "parameters - 1"  
              }         
            ],  
            "isLocked": false,  
            "fallbackResourceIds": [  
                "[resourceId(parameters('subscriptionId'), parameters('resourceGroupName'), 'microsoft.insights/components', parameters('workbookSourceId'))]"  
            ],  
            "fromTemplateId": "community-Workbooks/Performance/Performance Insights"  
          }  
        },  
        "resources": [  
          {  
            "name": "[parameters('workbookId')]",  
            "type": "microsoft.insights/workbooks",  
            "location": "[resourceGroup().location]",  
            "apiVersion": "2021-03-08",  
            "dependsOn": [],  
            "kind": "shared",  
            "properties": {  
              "displayName": "[parameters('workbookDisplayName')]",  
              "serializedData": "[string(variables('workbookContent'))]",  
              "version": "1.0",  
              "sourceId": "[resourceId(parameters('subscriptionId'), parameters('resourceGroupName'), 'microsoft.insights/components', 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#"  
      }  
    

    ---

    The original query was -
    "query": "requests\r\n| where timestamp >= ago(7d)\r\n| where cloud_RoleName == 'Placements'\r\n| summarize Count = count() by operation_Name\r\n| order by Count desc\r\n| project v = operation_Name, t = operation_Name, s = false\r\n| union (datatable(v:string, t:string, s:boolean)[\r\n'*', 'All Operations', true\r\n])",

    to which i tried to parameterized to below-

    "query": "[concat('let cloud_RoleName = "', parameters('cloud_oleName'), '"; requests\r\n| where timestamp >= ago(7d)\r\n| where cloud_RoleName == 'Placements'\r\n| summarize Count = count() by operation_Name\r\n| order by Count desc\r\n| project v = operation_Name, t = operation_Name, s = false\r\n| union (datatable(v:string, t:string, s:boolean)[\r\n'*', 'All Operations', true\r\n]))]"

    as i want to parameterized cloud_RoleName in the KQL query.

    below is the error Im getting -

    PS C:> az deployment group create --resource-group co-wus2-amnoneshared-rg-t01 --name Performance-Analysis-Credentialing-7 --template-file .\workbooktemplate.json
    {'code': 'InvalidTemplate', 'message': 'Deployment template validation failed: 'The template variable 'workbookContent' is not valid: The language expression 'concat('let cloud_RoleName = "', parameters('cloud_roleName'), '"; requests\r\n| where timestamp >= ago(7d)\r\n| where cloud_RoleName == cloud_roleName\r\n| summarize Count = count() by operation_Name\r\n| order by Count desc\r\n| project v = operation_Name, t = operation_Name, s = false\r\n| union (datatable(v:string, t:string, s:boolean)[\r\n'', 'All Operations', true\r\n)' is not valid: the string character '' at position '333' is not expected.. Please see https://aka.ms/arm-template-expressions for usage details.'.', 'additionalInfo': [{'type': 'TemplateViolation', 'info': {'lineNumber': 55, 'linePosition': 26, 'path': 'properties.template.variables.workbookContent'}}]}

    Please help if you can. Thanks

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.