Bicep template to display CPU time metric for an app service plan on a Azure Dashboard

Sangeetha Vadukut 5 Reputation points
2023-03-30T09:08:39.07+00:00

I am trying to use a Bicep file to deploy and create a shared dashboard to display the Server Response Time, Server requests, CPU performance, Memory alert etc of an App service Plan. But I get the following tile.

User's image

I am using Type

Extension/HubsExtension/PartType/MonitorChartPart

I am looking for a tile to be displayed as the following. Please provide me a bicep template for the same

User's image

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,654 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,951 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Ryan Hill 30,281 Reputation points Microsoft Employee Moderator
    2023-04-03T18:29:01.6666667+00:00

    Hi @Sangeetha Vadukut Try the following bicep

    resource dashboardTile 'Microsoft.Portal/dashboards/tiles@2021-08-01-preview' = {
      name: 'dashboardTileName'
      location: 'westus'
      properties: {
        lenses: {
          '0': {
            order: 0
            parts: {
              '0': {
                position: {
                  x: 0
                  y: 0
                  rowSpan: 2
                  colSpan: 3
                }
                metadata: {
                  inputs: [
                    {
                      name: 'queryInputs'
                      value: {
                        timespan: {
                          duration: 'PT1H'
                          start: null
                          end: null
                        }
                        id: '/subscriptions/6531c8c8-df32-4254-d717-b6e983273e5d/resourceGroups/contoso/providers/Microsoft.Web/serverfarms/appServicePlanName'
                        chartType: 0
                        metrics: [
                          {
                            name: 'Requests'
                            displayName: 'Server Requests'
                            aggregation: 'Total'
                            chartType: 'line'
                            color: '#00bfff'
                          }
                          {
                            name: 'ResponseTime'
                            displayName: 'Server Response Time'
                            aggregation: 'Average'
                            chartType: 'line'
                            color: '#ff8c00'
                          }
                          {
                            name: 'CpuTime'
                            displayName: 'CPU Performance'
                            aggregation: 'Average'
                            chartType: 'line'
                            color: '#ff0000'
                          }
                          {
                            name: 'MemoryWorkingSet'
                            displayName: 'Memory'
                            aggregation: 'Average'
                            chartType: 'line'
                            color: '#008000'
                          }
                        ]
                      }
                    }
                  ]
                  type: 'Extension/HubsExtension/PartType/MonitorChartPart'
                }
              }
            }
          }
        }
      }
    }
    

    Make sure you update the resource with the ID you want the tile to display for.


Your answer

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