Forum Discussion

wc123's avatar
wc123
Icon for Helper I rankHelper I
1 month ago
Solved

Linking Semantic Model refresh to Azure

Bit of a tricky problem here, but wanted to see if anyone would know a solution. I am currently using an Azure pipline that refreshes our data nightly. Lately the pipeline has been finishing inconsistenly causing some of our smentic models to refresh before the pipeline has finshed. I was wondering if there is some sort of trigger I can use so that the reports do not refresh untill the pipeline has finshed. We would prefer to not move the times of refreshs back as this does not happen everyday and users need data ASAP.

  • The cleanest fix is to stop relying on scheduled refresh and trigger the semantic model refresh from the pipeline itself, so it only fires once the pipeline has actually finished.

    At the end of your ADF pipeline, add a Web activity that calls the Power BI REST API:

    POST https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/datasets/{datasetId}/refreshes

    Authenticate with a service principal that is a Member of the workspace and enabled under the "Allow service principals to use Fabric APIs" tenant setting. Then turn off the scheduled refresh in the service so the two do not race each other.

    If you also want the pipeline to wait for the refresh to finish before reporting success, follow the Web activity with an Until loop that polls GET .../refreshes/{requestId} until the status is "Completed".

     

    If that was helpful, please give a thumbs up and mark it as resolved.

     

    Best,
    Shai Karmani

     

    Let's connect in LinkedIn

3 Replies

  • The cleanest fix is to stop relying on scheduled refresh and trigger the semantic model refresh from the pipeline itself, so it only fires once the pipeline has actually finished.

    At the end of your ADF pipeline, add a Web activity that calls the Power BI REST API:

    POST https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/datasets/{datasetId}/refreshes

    Authenticate with a service principal that is a Member of the workspace and enabled under the "Allow service principals to use Fabric APIs" tenant setting. Then turn off the scheduled refresh in the service so the two do not race each other.

    If you also want the pipeline to wait for the refresh to finish before reporting success, follow the Web activity with an Until loop that polls GET .../refreshes/{requestId} until the status is "Completed".

     

    If that was helpful, please give a thumbs up and mark it as resolved.

     

    Best,
    Shai Karmani

     

    Let's connect in LinkedIn

  • v-achippa's avatar
    v-achippa
    Icon for Community Support rankCommunity Support

    Hi wc123​,

    Thank you for reaching out to Microsoft Fabric Community.

    Thank you Shai_Karmani​ for the prompt response.

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user for the issue worked?  or let us know if you need any further assistance.

    Thanks and regards,
    Anjan Kumar Chippa

  • v-achippa's avatar
    v-achippa
    Icon for Community Support rankCommunity Support

    Hi wc123​,

    We wanted to kindly follow up to check if the solution provided by the user for the issue worked?  or let us know if you need any further assistance.

    Thanks and regards,
    Anjan Kumar Chippa