none
Automation of Application Insights Workbook Creation

    Question

  • Hi,

    Can Application Insights Workbook creation be automated? We have a requirement in the project where query will be saved as a workbook in the AI and application calls this to fetch some monitoring details. I have looked over the internet but could not find any pointers on this. Any help is much appreciated!



    Deepika Adike

    Thursday, January 17, 2019 6:37 AM

Answers

  • Hi Deepika,

    You can create a Workbook using ARM template but it is only available with "Troubleshooting guides (preview)" type. The current Workbooks under Investigate menu doesn't use ARM and not yet upgraded. However, you can still leverage "Troubleshooting guides (preview)" which has the same functionality as Workbooks

    

    If it is OK to use 'Troubleshooting guides (preview)' then please follow the below steps. If you really want to use Workbooks instead, you may need to wait until we finish the migration.

    Please add the following block under 'resources' node of your ARM template. To learn more about creating ARM template, please refer to Understand the structure and syntax of Azure Resource Manager Templates

        {
          "name": "{SPECIFY GUID}",
          "type": "Microsoft.Insights/workbooks",
          "location": "{REGION}",
          "kind": "shared",
          "apiVersion": "2018-06-17-preview",
          "dependsOn": [],
          "properties": {
            "displayName": "{YOUR WORKBOOK NAME}",
            "serializedData": "{WORKBOOK METADATA}",
            "version": "{THE VERSION OF YOUR WORKBOOK}",
            "sourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/microsoft.insights/components/{NAME_OF_YOUR_RESOURCE}')]",
            "category": "tsg"
          }
        }

    Here is the explanation of each placeholder:

    • {SPECIFY GUID}: Any random GUID like f8c696e7-2657-471c-9637-528840c524f4
    • {REGION}: Specify the location your workbook. The following is the list of available locations: Australia East, East US, France Central, Japan East, Korea Central, North Europe, South Central US, Southeast Asia, West Central US, West Europe, West US 2.
    • {YOUR WORKBOOK NAME}: A name of workbook.
    • {WORKBOOK METADATA}: The metadata of workbook. You can create one and get it from Advanced Editor of the existing Workbook. 
    • {THE VERSION OF YOUR WORKBOOK}: A version of your workbook. You can specify "1.0" as a default.
    • {NAME_OF_YOUR_RESOURCE}: A name of resource that this workbook belongs to. For example, if you want to have a workbook available under the one of your Application Insights resource called 'myTestApp', then specify 'myTestApp'. You can get this name as depicted as below:

    Hope this help you to create Workbook programmatically. If you have any further question, feel free to contact me at eric.chong@microsoft.com directly or just reply this conversation.

    Thanks,
    Eric Chong


    Friday, January 18, 2019 8:00 PM

All replies

  • Hi Deepika,

    Thank you for using Application Insights!

    Did you get a chance to go through the below documentation to automate the creation of custom reports in Application Insights?

    https://docs.microsoft.com/en-us/azure/azure-monitor/app/automate-custom-reports

    Please let us know if the above link helps solve your purpose.

    Thanks!

    Friday, January 18, 2019 12:48 PM
    Moderator
  • Hi Aman,

    Thank you for the reply!

    I have looked at the documentation, as I understood - this suggests a way to create a query manually from the portal? 

    My requirement here is - if I have a query, how do I create a workbook containing that query programmatically. Be it using any API's/C#/PS CMDLETS/ARM template.

    Please let me know if you need any further info on this.

    Thanks!


    Deepika Adike

    Friday, January 18, 2019 12:57 PM
  • Hi Deepika,

    You can create a Workbook using ARM template but it is only available with "Troubleshooting guides (preview)" type. The current Workbooks under Investigate menu doesn't use ARM and not yet upgraded. However, you can still leverage "Troubleshooting guides (preview)" which has the same functionality as Workbooks

    

    If it is OK to use 'Troubleshooting guides (preview)' then please follow the below steps. If you really want to use Workbooks instead, you may need to wait until we finish the migration.

    Please add the following block under 'resources' node of your ARM template. To learn more about creating ARM template, please refer to Understand the structure and syntax of Azure Resource Manager Templates

        {
          "name": "{SPECIFY GUID}",
          "type": "Microsoft.Insights/workbooks",
          "location": "{REGION}",
          "kind": "shared",
          "apiVersion": "2018-06-17-preview",
          "dependsOn": [],
          "properties": {
            "displayName": "{YOUR WORKBOOK NAME}",
            "serializedData": "{WORKBOOK METADATA}",
            "version": "{THE VERSION OF YOUR WORKBOOK}",
            "sourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/microsoft.insights/components/{NAME_OF_YOUR_RESOURCE}')]",
            "category": "tsg"
          }
        }

    Here is the explanation of each placeholder:

    • {SPECIFY GUID}: Any random GUID like f8c696e7-2657-471c-9637-528840c524f4
    • {REGION}: Specify the location your workbook. The following is the list of available locations: Australia East, East US, France Central, Japan East, Korea Central, North Europe, South Central US, Southeast Asia, West Central US, West Europe, West US 2.
    • {YOUR WORKBOOK NAME}: A name of workbook.
    • {WORKBOOK METADATA}: The metadata of workbook. You can create one and get it from Advanced Editor of the existing Workbook. 
    • {THE VERSION OF YOUR WORKBOOK}: A version of your workbook. You can specify "1.0" as a default.
    • {NAME_OF_YOUR_RESOURCE}: A name of resource that this workbook belongs to. For example, if you want to have a workbook available under the one of your Application Insights resource called 'myTestApp', then specify 'myTestApp'. You can get this name as depicted as below:

    Hope this help you to create Workbook programmatically. If you have any further question, feel free to contact me at eric.chong@microsoft.com directly or just reply this conversation.

    Thanks,
    Eric Chong


    Friday, January 18, 2019 8:00 PM
  • Thanks Eric. 



    Deepika Adike

    Monday, January 28, 2019 11:38 AM