Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Create a fabric deployment pipeline using rest API call

Hi Team,

 

We are working on a solution to automate our process for fabric, was trying to create fabric deployment pipeline using rest API call but not able to do it, also tried checking all documentations, couldn't find anything.

Is there any way we can create it apart from manually from UI?

Would love to hear back any recommendations. 

Thanks in advance 🙂

9 Replies

  • hi Anonymous , 


    Please use the below endpoints for Deployment pipeline automation. But before that please make sure  have appropriate permissions for the pipeline and workspace in Microsoft Fabric.Obtain a Microsoft Entra token for authentication. This token is required in the API's authorization header.

    Install the Azure PowerShell Az module if working with Azure DevOps

     

     

    Steps : 

    POST https://api.fabric.microsoft.com/v1/workspaces/<workspaceId>/items

     

    Request Body Example:

    {
    "displayName": "MyDeploymentPipeline",
    "type": "DeploymentPipeline"
    }

     

    Once the pipeline is created, assign specific workspaces to its stages (e.g., development, test, production). Use the following API:

     

    PATCH https://api.fabric.microsoft.com/v1/workspaces/<workspaceId>/items/<pipelineId>

     

    Request Body Example:

    {
    "stages": [
    {
    "stageOrder": 0,
    "workspaceId": "<developmentWorkspaceId>"
    },
    {
    "stageOrder": 1,
    "workspaceId": "<testWorkspaceId>"
    },
    {
    "stageOrder": 2,
    "workspaceId": "<productionWorkspaceId>"
    }
    ]
    }

     

    Deploy Content Between Stages

    To deploy content from one stage to another, use the Deploy Stage Content API:

    POST https://api.fabric.microsoft.com/v1/deploymentPipelines/<pipelineId>/stages/<sourceStageId>/deploy

     

    Request Body Example:

    {
    "targetStageId": "<targetStageId>",
    "options": {
    "allowCreateArtifact": true,
    "allowOverwriteArtifact": true
    }
    }

     

    More details can be found here : https://www.purplefrogsystems.com/2024/05/how-to-call-microsoft-fabric-data-pipelines-dynamically-using-apis/


     

     


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

    Regrds

    Nilendra

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks for the reply and giving the solution, but unfortunately the below code piece didn't workout for creating the Fabric Deplotment Pipeline:

    POST https://api.fabric.microsoft.com/v1/workspaces/<workspaceId>/items

     

    Request Body Example:

    {
    "displayName": "MyDeploymentPipeline",
    "type": "DeploymentPipeline"
    }

    It raised the below error
    Invoke-RestMethod:
    {
    "requestId": "2f2e0af5-2a7c-4765-8077-c84e74ee03d3",
    "errorCode": "InvalidItemType",
    "message": "Requested item type \u0027DeploymentPipeline\u0027 is invalid"
    }

     

    which tells there is not such itemType available, also refered microsoft Doc Items - Create Item - REST API (Core) | Microsoft Learn which consists of list of all items available which doesn't consist of what you have recommended. 
    Is there any other solution you can recommend for the same. Thanks in advance.

  •   

    My bad , I was reading a wrong article ( the things which I have mentioned will eventually be available ).

    There is currently no direct API method to create a Fabric Deployment Pipeline programmatically. 

    Microsoft has announced plans to finalize public APIs for Deployment pipelines on the Fabric platform. The estimated release timeline for these enhancements is Q1 2025

    . These upcoming APIs are expected to include:

    Anonymous

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks a lot for the update.
      Just wanted to know we cannot create the deployment pipeline from Rest API call, but can we trigger or run the deployment pipeline using any API call? 
      Would like to know do we have any such solution available for deploying artifacts from one workspace to another using the deployment pipeline using API call while doing the authentication using service principle, also let me know the necessary permissions required for same.

       

      Thanks a lot!

  • v-saisrao-msft's avatar
    v-saisrao-msft
    Community Support

    Hi Anonymous 

    Thank you for posting in Microsoft forum community.

     

    In addition to the helpful response provided by nilendraFabric ,Could you please confirm if your questions have been resolved? If this is helps, give 'kudos' and Accept it as the solution. This will assist other community members in resolving similar issues more efficiently.

     

    Thank you.

  • hrosillo's avatar
    hrosillo
    Frequent Visitor

    Deployment Pipelines using API

    Reference: https://learn.microsoft.com/en-us/rest/api/fabric/core/deployment-pipelines/deploy-stage-content?tabs=HTTP

    Microsoft Entra supported identities
    This API supports the Microsoft identities listed in this section.

    Identity | Support
    ====================== ============
    User                                                           | Yes
    Service principal and Managed identities | Only Power BI Items are supported

     

    Now, for the following question:

    You have a Fabric workspace named Workspace1.
    You plan to integrate Workspace1 with Azure DevOps.
    You will use a Fabric deployment pipeline named deployPipeline1 to deploy items from Workspace1 to higher environment workspaces as part of a medallion architecture. You will run deployPipeline1 by using an API call from an Azure DevOps pipeline.
    You need to configure API authentication between Azure DevOps and Fabric.
    Which type of authentication should you use?

    A. service principal
    B. Microsoft Entra username and password
    C. managed private endpoint
    D. workspace identity

    For my is letter "B"

    Could you please help me understand this in more detail?

    In what real-world context could I use Power BI using an API with a Service Principal? It seems that this cannot be done in Fabric, which is why it is used to make it dynamic.

    Thanks.