Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
oleg_bezhan
New Member

Is it possible to update workspace from git repository using an API call?

Hello!

Context:

We are trying to set up a CI/CD process for Power BI. We have 3 workspaces for each region - `dev`, `qa`, and `prod`.  We configured git integration for the dev workspace and also created pipelines in AzDO to deploy things from `dev` to `qa` and further to prod. Everything works fine, the only problem we have right now is the fact that when PR is merged to the `main` branch we have to manually go to the `dev` workspace, and click the "Update all" button. That's really annoying and error-prone, especially given the fact that we deploying the same change to multiple `dev` workspaces (one per region).

 

Question:

Is it possible to perform an update using an API call instead of clicking the button in the UI? If such an API is available we would be able to call it from the CI/CD pipeline after merging to the `main` branch.

 

An alternative might be a setting to automatically update the workspace if any changes are detected in the git upstream - without user consent ("Update all" button) - but I don't think it's available either.

 

Screenshot for the reference:

oleg_bezhan_0-1695730632996.png

 

Thank you 🙂 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @oleg_bezhan 

 

Yes, it is possible to update a Power BI workspace using an API call instead of clicking the "Update all" button in the UI. Power BI provides a set of REST API calls to retrieve information on pipelines and their content, to help you build the deployment you want to run.

 

You can use the Power BI REST API to update the content of a workspace. Specifically, you can use the API to import a Power BI report, dataset, or dashboard into a workspace, and the API to update the content of an existing report, dataset, or dashboard.

 

To update the content of a workspace, you can use the API to update the report, dataset, or dashboard in the workspace. You can call this API from your CI/CD pipeline after merging to the branch.

 

Here is an example of how to use the API to update a report in a workspace:

PATCH https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports/{reportId}

{
    "name": "My Report",
    "defaultState": {
        "playback": {
            "autoplay": true,
            "loop": true
        }
    }
}

I hope this helps!

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
ZakharRealogic
New Member

I have no idea why this topic is marked as "solved". It doesn't work because the API lacks such a method. The request returns with a 404 (not found) status. What is the workaround? The Git Integration feature works, but this limitation makes it unusable.

oleg_bezhan
New Member

Thank you @v-zhangti !

I'll give it a try.

Hey,

 

Did you manage to make it work? I'm in the same boat and this is the only thing missig for me to complete CI/CD for PBI.

 

Thx!

Hi Bezhan,

 

Is the solution working for you. I am also working on the same, but couldn't make it work.

 

Thanks,

Bhaskar D

v-zhangti
Community Support
Community Support

Hi, @oleg_bezhan 

 

Yes, it is possible to update a Power BI workspace using an API call instead of clicking the "Update all" button in the UI. Power BI provides a set of REST API calls to retrieve information on pipelines and their content, to help you build the deployment you want to run.

 

You can use the Power BI REST API to update the content of a workspace. Specifically, you can use the API to import a Power BI report, dataset, or dashboard into a workspace, and the API to update the content of an existing report, dataset, or dashboard.

 

To update the content of a workspace, you can use the API to update the report, dataset, or dashboard in the workspace. You can call this API from your CI/CD pipeline after merging to the branch.

 

Here is an example of how to use the API to update a report in a workspace:

PATCH https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports/{reportId}

{
    "name": "My Report",
    "defaultState": {
        "playback": {
            "autoplay": true,
            "loop": true
        }
    }
}

I hope this helps!

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Should this still work?

 

When I try it with a patch request I'm getting:

`No HTTP resource was found that matches the request URI 'http://api.powerbi.com/v1.0/myorg/groups/cfdb......./reports/319490f...../`

 

The guid's are correct and I'm authenticating correctly. Testing using GET instead of PATCH works fine.

 

Realise I cna loop though all reports in a workspace but would be great if there was similar that did an "Update all" for the workspace.

 

In a similar way is there then an API end point to republish the workspace App?

 

Many thanks

 

Ben



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

I've just found it in the fabric roadmap.

API endpoints I think I need aren't coming until Q1 2024:

 

https://learn.microsoft.com/en-gb/fabric/release-plan/admin-governance#REST



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

This has now been released!



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Yes, but Service Principal isn't supported yet or am I wrong?

Yes no service principal support. Read a suggestion somewhere it would be available after build.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors