Forum Discussion

CrazyCraigo's avatar
CrazyCraigo
Frequent Visitor
2 years ago
Solved

Import Dataflow JSON via Power BI Rest API with Powershell

Does anyone have a recent example of performing and import of a dataflow json to a given workspace using powershell. I'm thinking really about this API -  https://learn.microsoft.com/en-us/rest/api/...
  • CrazyCraigo's avatar
    2 years ago

    For anyone else coming across this issue the solution turned out to be (thanks to some help and guidance from microsoft support) to remove the "partitions" section at the bottom of the import json file. 

     

    Steps to get there were 

     

    1. Export the dataflow as JSON.

    2. Change the  allowNativeQueries value to be "false" (you get a clear warning about this)

    3. Remove the partition section at the bottom of the file

    4. Use Postman to submit the file

     

    Since I to perform this action via powershell I was able to export the required powershell comments from postman saving me having to fight with how to submit the multipart post. 

     

    It should also be noted that when you submit the dataflow the id you get back is the "Import ID". Not the dataflow ID as first thought. This ID can be submitted to the 

     

    https://api.powerbi.com/v1.0/myorg/groups/{workspaceid}/imports/{importid} endpoint with returns the status iof the import including the dataflow id once its finally succeded.