Forum Discussion
Publishing Power BI Project File to Fabric Workspace in Automated fashion
Hi everyone,
So I am exploring on the concept on how to publish a Power BI Project file (pbip) to a respective workspace. I got few resources one of them being the documentation (which had some Power BI APi's)
Deploy a Power BI project using Fabric APIs - Microsoft Fabric REST APIs | Microsoft Learn
From the above documentation I found the create item (POST) a bit relevant
Items - Create Item - REST API (Core) | Microsoft Learn
So I began with script design (the programming language under the hood is Python), so I have created functions :
-> To publish the semantic model
-> To publish the Report (For pbix and pbip these functions are different)
So for '.pbix' I have no issues once I run the script I am able to publish the Semantic Model and the Report as the respective workspace. The issues arises when I am trying to publish the pbip file in this case I am only able to publish the Semantic Model but when I try to publish the pbip file it 'Fails'
The reason in definition.pbir it still points to the Semantic model on my local system instead it should be pointing out to the Semantic Model in the workspace (i.e. make use byConnection instead of 'byPath'). So my question was can we not publish pbip to the workspace (only pbix is accepted format), is there any way we can make the changes in definition.pbir.
The next question was is it possible to convert pbip to pbix (programatically), for this I had asked this question on Forum and I received few responses as well:
https://community.fabric.microsoft.com/t5/Desktop/Conversion-of-PBIP-to-PBIX-PBIT-and-uploading-the-report-to/td-p/4722580
Apart from these are there any methods.
If there is any additional information please do let me know I will be happy to share
Regards,
Sidhant.
Hi everyone,
So as per my observation and checking few of the comments on the forum what I have concluded publishing the 'Power BI Project file (*.pbip)' has some issues (I was able to publish the same but it was not loading the data on the visuals), so I have skipped the pbip altogether and continuing with Power BI File (*.pbix).So basically I have created a script which takes in two arguments: workspace id and the report_file_path (and the POST API I am using the one that's been provided in the Microsoft documentation).
And for one of the sub-query that I had asked convering pbip to pbix: I am making use of Power AUtomate Desktop which opens the Power BI Desktop and saves it as: Power BI File (*.pbix)
So I will be closing this thread as I have found the solution.
Regards,
Sidhant.
7 Replies
- v-hashadapu
Community Support
Hi Sidhant , Thank you for reaching out to the Microsoft Community Forum.
At the moment, you can’t publish .pbip reports directly to a Power BI workspace using the REST API, unless the report’s definition.pbir file is set up to reference a semantic model that's already published to the service using byConnection. The problem is that when you create a .pbip in Power BI Desktop, it links the report to the dataset on your local machine using byPath and the REST API doesn’t support that. That’s why your deployment fails. Microsoft hasn’t added full support yet for deploying .pbip reports through APIs or automation tools when they use byPath. And unfortunately, there's no built-in way to convert a .pbip project to a .pbix file programmatically. The only option right now is to open it in Power BI Desktop and save it manually as a .pbix.
There is a potential workaround, but it’s not officially supported. You can try editing the definition.pbir file to swap out the byPath reference and replace it with a byConnection block that points to the workspace and dataset IDs of your already-published semantic model. If you make that change, you can try publishing the report again using the Create Item API. Just keep in mind that this approach is fragile, if anything in the structure or schema is off, it might still fail, because the API isn’t really built to handle manually patched .pbip files. For reliable automation, using .pbix is still the best and only officially supported approach.
If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.- Sidhant
Advocate V
Hi v-hashadapu ,
Thanks for the response, you are right in case of pbip the semantic model points out to the Semantic model stored on local (which is byPath) instead it should be pointed out to the Semantic Model in the respective workspace i.e. byConnection (live Connection).
So to do that I did a slight tweak in my code base wherein in the definition.pbir I gave the expected structure which is required (byConnection).
(I will just give a hort overview of my script so basically I had a zip file which had the Poweer BI Project (pbip) structure that includes the .Report, .SemanticModel, pbip file and I just renamed that from zip to pbip -> Then the extraction is done in a new folder (Report_name.pbip.extract) -> Then the respective semantic model is published and then the pbip file)
So after the script ran I was able to publish the pbip and the semantic model (made the respective changes in .pbir file), and I tried to open the pbip file (in the extracted local folder), but it threw the following error pop-upSo to cross check: I just opened the 'definition.pbir' file (inside the semantic folder), the structure seemed to be correct:
And the other thing was in Fabric workspace the report seem to have no data to show (blank)Any idea what might be the cause for this.
Also for the conversion part from pbip to pbix I will try to post this on the Ideas forum so maybe in the upcoming updates this might be looked into, I just would have a small request just to give a Kudo to the same (will share the idea link here)
Regards,
Sidhant.- v-hashadapu
Community Support
Hi Sidhant , Thank you for reaching out to the Microsoft Community Forum.
Thanks for the update and for digging into the details. You're absolutely right — switching the .pbir file to use byConnection is necessary when publishing a .pbip project via the REST API. Just to clarify though, once you make that change, Power BI Desktop won't be able to open the .pbip file anymore, since it only supports byPath references during development. So, the error you ran into when trying to open it locally is expected.
Regarding the report showing up blank in the workspace, this usually means the report isn’t connecting properly to the semantic model. I’d recommend double-checking that the dataset ID and name in your byConnection block exactly match the one you published. Also make sure the dataset has data, has been refreshed and that there aren’t any permission issues (like RLS) getting in the way. Sometimes even a small mismatch or an outdated layout file can cause visuals not to render.
And yes, regarding submitting this in Microsoft Fabric Ideas, that is a great way to influence future updates, make sure to get as many upvotes as possible.
If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
- v-hashadapu
Community Support
Hi , Hope you are doing well. Kindly let us know if the issue has been resolved or if further assistance is needed. Your input could be helpful to others in the community.
Also, Could you please confirm if you've submitted this as an idea in the Ideas Forum? If so, sharing the link here would be helpful for other community members who may have similar feedback. For any further discussions or questions, please start a new thread in the Microsoft Fabric Community Forum, we’ll be happy to assist.
Thank you for being part of the Microsoft Fabric Community.
- v-hashadapu
Community Support
Hi Sidhant , hope you are doing great. May we know if your issue is solved or if you are still experiencing difficulties. Please share the details as it will help the community, especially others with similar issues.
- Sidhant
Advocate V
Hi v-hashadapu ,
Forgot of mentioning that the issue is been resolved, I have added my latest reply and will be marking it as an solution. Thanks for the initial comment it did help me to look it from different route.
Regards,
Sidhant.
- Sidhant
Advocate V
Hi everyone,
So as per my observation and checking few of the comments on the forum what I have concluded publishing the 'Power BI Project file (*.pbip)' has some issues (I was able to publish the same but it was not loading the data on the visuals), so I have skipped the pbip altogether and continuing with Power BI File (*.pbix).So basically I have created a script which takes in two arguments: workspace id and the report_file_path (and the POST API I am using the one that's been provided in the Microsoft documentation).
And for one of the sub-query that I had asked convering pbip to pbix: I am making use of Power AUtomate Desktop which opens the Power BI Desktop and saves it as: Power BI File (*.pbix)
So I will be closing this thread as I have found the solution.
Regards,
Sidhant.