Home > Blockchain >  How to deploy my Azure Monitor Workbook in Azure pipeline (yml)
How to deploy my Azure Monitor Workbook in Azure pipeline (yml)

Time:07-21

I'm new to Azure Monitor Workbook. I managed to create a workbook, which should be used as a template for each application that gets deployed.

We're using Powershell scripts with az cli commands to deploy the application (build resource group, AppInsights, etc.).

Reading https://docs.microsoft.com/en-us/azure/azure-monitor/visualize/workbooks-automate#working-with-json-formatted-workbook-data-in-the-serializeddata-template-parameter I understand I can put my ARM template with the workbook data in a Storage blob and using --template-uri as explained in https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-cli#deploy-remote-template I can create a resource from this template.

  • Q1. The above process feels a bit hacky, is that the suggusted path to take?
  • Q2. How can I check if the workbook already exists, so I don't create a new workbook on every deployment?
  • Q3. How can I change the name of the workbook. It is now named [GUID]-(MyName). If it needs to have a GUID can I change it to MyName-[GUID]? That makes it much more readably in the overviews?

CodePudding user response:

  1. You can also use local deployment by including the ARM template with the workbook data in your repository. This is a very common approach known as Infrastructure as Code. While a workbook may not feel like infrastructure, in terms of deployment it's the same as any other resource in Azure.

  2. Azure Resource Manager will only redeploy the workbook if there are changes compared to the currently deployed workbook. See the documentation on deployment mode for more information.

If the resource already exists in the resource group and its settings are unchanged, no operation is taken for that resource.

  1. Unfortunately, the name needs to be a GUID. However, you can set a displayName property. This is "the friendly name for the workbook that is used in the Gallery or Saved List. Needs to be unique in the scope of the resource group and source." Azure Monitor Workbook Template Parameters on Microsoft Docs
"resources": [
    {
      "name": "[parameters('workbookId')]",
      "type": "microsoft.insights/workbooks",
      "location": "[resourceGroup().location]",
      "properties": {
         "displayName": "Prettier Workbook Name",
         ...
      },
      ...
    }
]
  • Related