Issues on PostImportWithFileAsyncInGroup while using service principal id and secret as authentication

Kumar Kundu, Sudipta 0 Reputation points
2025-02-10T14:03:02.4866667+00:00

We have recently updated our code in ASP.Net Core 8 and are creating bearer token using service principle and secret. But now we are facing issues when we try to add or update dataflows and reports in the workspace using this predefined function - PostImportWithFileAsyncInGroup.In dataflows case the code generates no exception from backend code but no dataflow is added on the workspace in powerbi portal.In case of reports we see the report added to the workspace but we are not able to fetch the parameter of the generated dataset.Please help us if there is an efficient way to perform this task.

Developer technologies | ASP.NET | ASP.NET Core
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Danny Nguyen (WICLOUD CORPORATION) 410 Reputation points Microsoft External Staff
    2025-06-24T03:26:14.4866667+00:00

    Hi @Kumar Kundu, Sudipta,

    From what I've seen from your problem, I have found similar threads that has solutions that might fix yours.

    Try adding a delay to fix Import completion timing:

    • The PostImportWithFileAsyncInGroup method returns an Import object immediately, but the dataset metadata (including parameters) isn't populated until the import process is fully completed. If you call GetImportInGroupAsync too early, it may return incomplete data
    • You can add a custom dela yor polling mechanism to check the import status until it reaches Succeeded before accessing dataset parameters:
    await Task.Delay(500);
    import = await pbiClient.Imports.GetImportInGroupAsync(groupId, importId);
    

    https://community.fabric.microsoft.com/t5/Developer/Uploading-a-PBIX-file-with-PostImportWithFileAsyncInGroup-does/m-p/4632617

    https://stackoverflow.com/questions/79546494/powerbi-powerbiclient-postimportwithfileasyncingroup-sometimes-results-in-no-d

    Also ensure that:

    • The workspace is in a Premium capacity (dataflows require this for full functionality).
    • The service principal has the necessary permissions (Admin or Member role).
    • The dataflow definition is valid and includes all required schema metadata.

    If you are still having any issues, feel free to reach out.

    Best Regards.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.