1

I've spent some time getting a dashboard together on a project in Azure DevOps. I've got 14 queries backing it up, and 3 different widget types used. Brilliant. The issue I have is that I now need to roll this out to 70+ projects.

I exported all my queries using the WIQL marketplace extension but only seem to be able to import them into the other projects one at a time which is very time-consuming. I'm then needing to match the right query with the right widget in the dashboard, and again it's time-consuming. I've been looking for a way to copy dashboards but one doesn't seem to exist from what I've found.

Can anyone suggest a way that I can cut down the time for this? Even if it's just a way to get my queries across the different projects - that would be a huge time-saving.

I've tried Googling and YouTube as well, but seem to hit a brick wall - perhaps my search terms are wrong? - because I'm directed to pages and instructions on importing work items rather than queries.

James
  • 163
  • 1
  • 2
  • 12
  • Does this answer your question? [In azure devOps, how to duplicate dashboard in a project](https://stackoverflow.com/questions/59744559/in-azure-devops-how-to-duplicate-dashboard-in-a-project) – Matt Sep 23 '20 at 19:18
  • Looks like it could be promising... looks like it's something that many people are after as well, which reflects what I'd read previously. In terms of ease to make changes - is this something that a complete newbie could fathom? Or would it be too advanced for a rookie?? – James Sep 23 '20 at 21:09
  • If you are speaking to the python script, I don't know the language so hard for me to judge. The alternative is to do all of this manually right? You probably know how long it takes to do one project, how long would it take you to do 70. How long do you think you could work out an automation before it is no longer worth automating? Since the script exists and leverages and already built library ... I wouldn't think it is incredibly complex. – Matt Sep 24 '20 at 01:16
  • @James How about the issue? Does the answer below resolved your question, If not, would you please let me know the latest information about this issue? – Walter Oct 02 '20 at 09:27

2 Answers2

1

In addition to the python script and c# code shared in this ticket, you can also try to use REST API to copy dashboards. Here are the steps:

  1. Get a dashboard by its ID.

    GET https://dev.azure.com/{organization}/{project}/{team}/_apis/dashboard/dashboards/{dashboardId}?api-version=6.1-preview.3

  2. Copy the response body of the get dashboard REST API and delete the dashboard id.

enter image description here

  1. Create the supplied dashboard.

    POST https://dev.azure.com/{organization}/{project}/{team}/_apis/dashboard/dashboards?api-version=6.1-preview.3

Please paste the response body to the request body in this REST API. You only need to change the project name and team name here to copy to different projects. enter image description here 4.Currently, some widget settings may get null values , and you may need to manually configure them in new dashboards.

In addition, the product group is developing this feature. Here is the feature timeline. Please track and follow this ticket for latest updates.

Walter
  • 2,640
  • 1
  • 5
  • 11
  • Worked perfectly, thank you, and it should save a lot of time. Now I just have to figure out if I can do something similar with creating queries and popping them into the Shared Queries group. – James Oct 03 '20 at 19:42
  • 1
    Now I've got queries creating too so this should save me a lot of time. Thanks again. – James Oct 03 '20 at 19:50
0

If you are familiar with PowerShell you can use AzurePipelinesPS to copy a dashboard or a query. The Copy-APDashboard and Copy-APQuery commands support cross collection and cross project copying.

Dashboard

The following will copy a dashboard into the same project as the source.

Copy-APDashboard -Name 'My Current Dashboard' -Session 'mySourceSession' 

The following will copy a dashboard into a different project in the same collection.

Copy-APDashboard -Name 'My Current Dashboard' -Session 'mySourceSession' -TargetProject 'Other Project Name'

Query

The following will copy a query named 'My Query To Copy' into the project named 'Project2'.

Copy-APQuery -QueryId 'Shared Queries/My Query To Copy' -Name 'My New Query' -TargetProject 'Project2' -Session 'mySourceSession' 

See AzurePipelines Session Management for more details on how to create a session and save it for use in later PowerShell sessions

Note:

Copy-APDashboard does not copy the underlying queries, only the dashboard widgets and scope. You must copy the queries using Copy-APQuery.

Dejulia489
  • 1,165
  • 8
  • 14