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
- Azure Subscription required (https://azure.microsoft.com/en-gb/free/)
- Deploy a simple VM only if you don’t have any resources (https://github.com/Azure/azure-quickstart-templates)
- Create the new Dashboard and Publish the dashboard to a resource group
- Using the https://resources.azure.com , extract the JSON format of the dashboards
- Parameterize the hardcoded values
- Create a project in octopus and add variables within the projects finally add the deploy resource group step
- Create a new release and deploy
- Navigate to portal.azure.com and check the new dashboards
- 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.
- 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
- 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.
- 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.
- 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.
- 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.
- Deploy to Azure and validate
Once release is created , push the big deploy button.
Here is the arm template for your to have a look
Next blog, I will discuss about the Role Based Access Control for dashboard.