Azure users often need to move resources to another resource group or subscription because they are not rich enough. After the move is completed, the corresponding Dashboard components will become invalid. Usually, we need to delete and rebuild these dashboard cards one by one. Is there a quick and accurate way to repair Dashboard in one step?
Take my blog as an example, I moved my Application Insights resource from "ediwang-blog-group" to "prod-group". Then, my dashboard blows up:
There are more than a dozen of chart like this on the dashboard, manually delete and recreate them will take a few hours. This is not how a typical Microsoft product should be used. We need a more efficient way to fix the dashboard.
Fix the dashboard in a few minutes
In fact, the layout and data of your Azure dashboard is stored and can be exported as JSON file for editing and sharing. We only need to modify a few lines in the JSON file to quickly fix the dashboard.
Click "Download" button on the broken dashboard, and save the JSON file to local file system.
Open the JSON file with Visual Studio Code.
In my case, I just need to replace the old resource group name "ediwang-blog-group" with the new resource group name "prod-group", which is the new location where the resource was moved.
If your resource was moved across subscriptions, you may also need to replace the subscription ID for the moved resources.
Press "CTRL + H" to find and replace values, and then save the file.
Go back to Azure, click "+ New dashboard", "Upload", and select the modified JSON file.
Now, the dashboard is restored correctly, you can delete the old broken dashboard now.