Building Azure Dashboards using ARM Template and Deploy via Octopus Deploy

The process of  building dashboard in azure is really easy by pining the area to the dashboards. Normally engineers login to the portal to create the dashboards. I have been promoting this model at various people I work with. Again, one of the things which kept me striking was how best and far we can go with automation of dashboards. There is no clear documents available in the Microsoft documentation . when exploring the apis to get more details information of how and where the published dashboards available. I found lot of interesing stuff. It’s a resource available within the resource group but its not visible within the azure portal. you can view them via azure resource explorer. Its under the provider microsoft.portal. At the end of the blog post attached the sample template.

Below are the steps you might need to follow if you want to automate the identical dashboards in different environments

  1. Azure Subscription required (https://azure.microsoft.com/en-gb/free/)
  2. Deploy a simple VM only if you don’t have any resources (https://github.com/Azure/azure-quickstart-templates)
  3. Create the new Dashboard  and Publish the dashboard to a resource group
  4. Using the https://resources.azure.com , extract the  JSON format of the dashboards
  5. Parameterize the hardcoded values
  6. Create a project in octopus and add variables within the projects finally add the deploy resource group step
  7. Create a new release and deploy
  8. Navigate to portal.azure.com and check the new dashboards

 

  1. Azure Subscription

If you already own a azure subscription, skip this step. If not create one pay as you go or an appropriate one for your requirements.

  1. Deploy a simple VM

Skip this step if you already have a vm or any other azure resource if you want to monitor otherwise you quick starter templates to build a resources needs for your requirement. In this blog post we are using the Virtual Machines

  1. Create new dashboard manually

In this stage we are going to create a dashboard manually which allows you to familiarize in creating the dashboard and see what metrics you want to see. Once you are happy with want you wanted then you can publish the changes to a resource group. Additional you can define RBAC and share with appropriate person within the organisations.

dashboards011 v + New dashboard Z Edit dashboard Disk Read Bytes and Disk Write Bytes for the past hour Unshare 16:15 16:15 ? Fullscreen Clone Ij Delete Percentage CPU for the past hour OCTOPUS-VM IOOMB BOMB 60MB 40MB 20MB OMB 15:30 89 96 15:45 16 OCTOPUS-VM 100% 20% 0% 15:30 PERCENTAGE CPU 0.82% 15:45 16 16: Network In and Network Out for the past hour OCTOPUS-VM 1.4MB 1.2MB IMB 0.8MB 0.6MS 0.4MB 0.2MB OMB 1 5:30 NETWORKIN 15:45 NETWORK OUT 16

  1.  Azure Resource Explorer

Azure resource explorer can be really useful if you need to automate using ARM template , Azure Powershell or Azure CLI. Also, it can be really useful when you are interested in exploring the resources if you are having multiple subscription.  In this case we will navigate to the resource group we deployed the dashboard and expand the microsoft.protal resource provider where you can find the dashboards. Under that, each dashboards will be represented/identified by a GUID. When you explore and copy the JSON format.

dashboards02

  1. Parameterize the hardcoded values

If you quickly scroll through the template you will be able to see subscription id , resource group names and the actual resources will be hardcoded within the template. If you want to automate the dashboards to use in different environments then I would highly recommend to action this step.

dashboards03

  1. Octopus Deploy

Ocoptus Deploy are first class citizen in deploying Azure resources and application into azure. Now, we need to create the dashboards in the automated fashion using octopus deploy. Add azure subscription into Octopus Accounts. Using the Deploy Azure resource group template and paste your json template pass in the appropriate parameter values for the template. I would recommend separate resource group for the dashboard ARM template deployments.

dashboards04

 

dashboards05

  1. Deploy to Azure and validate

Once release is created , push the big deploy button.

dashboards06

 

Here is the arm template for your to have a look

 

Azure ARM Template for Dashboards (quick start template)

Next blog, I will discuss about the Role Based Access Control for dashboard.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.