Backup and restore or JSON

Failing to back up dashboards and workbooks has caused me significant issues several times recently. Most often this is a result of my accidentally closing a browser window or refreshing the page and losing the query(s) that I was working on. This blog post shows a quick method to backup & restore both dashboards and workbooks in Azure.

Dashboards:

Backing up dashboards:

Backing up dashboards is very simple. Just click on the download icon (shown below) and it will save off the JSON file for your dashboard. This will also save off each version with an incrementally increased number. When updating or developing dashboards, I do this whenever I make a significant change to a dashboard.

If you are visualizing data from Log Analytics in Azure dashboards, there is a query history option available that shows your recent queries (shown below).

Additionally, you can save off your finished queries, so they are easy to retrieve (click on Save as shown below).

When you choose to save you name the query and put it into a category. Generally, I create a new category for each type of dashboard I am working on.

These saved queries appear in which you choose the “query explorer” option (shown below).

Restoring dashboards:

To restore a dashboard, choose the Upload option shown below.

Point to the JSON file backup you want, and you can restore it as a non-shared dashboard.

Workbooks:

Backing up workbooks:

To backup up a workbook, open the workbook, and edit the workbook (shown below).

Next, open the advanced editor (shown below with the </> icon).

Click the down arrow to download the JSON for the workbook.

Different iterations will download with different version numbers making it easy to go back to earlier versions of the dashboard file (just like we see for how we can download versions of an Azure dashboard).

Restoring workbooks:

To restore a workbook, open the workbook and choose the Edit option (shown below).

Next, open the advanced editor (shown below with the </> icon).

To restore the workbook, open the JSON file from your downloads and cut and paste the contents to replace the JSON content with your backed-up content.

Apply those changes and you are good to go!

Tip: To move a dashboard or a workbook between environments you will most likely need to change at least the subscription information contained within the JSON content. An example of this is shown below where we made the following changes:

/subscriptions/{GUID}/resourceGroups/LogAnalytics/providers/microsoft.operationalinsights/workspaces/{WorkSpaceName}

Summary: To backup dashboards and workbooks use the options to download them into JSON files. These files can then be re-imported (for dashboards) or cut and pasted in (for workbooks) to restore the file you backed up.