Forum Discussion

Sukiazure007's avatar
Sukiazure007
Regular Visitor
1 year ago
Solved

Guidance on Updating Connections After Deploying Notebooks Using Fabric APIs | Azure DevOps

Dear all,  I used the updateFromGit, getStatus, and longOperation Fabric APIs to successfully deploy Notebooks to a specific Workspace ID. However, the deployment retained the Dev connections, and I now need to update them to UAT or PROD connections.

What I Have Done So Far:

  • Queried the connections for all items within the workspace.

  • Noticed that some items, such as Semantic Models and Dataflows, do not have connections.

What I Need Help With:

  1. Which connections need to be updated after deployment?

  2. What is the process to update these connections using Fabric APIs?

  3. Are there any best practices or considerations when managing connections across environments?

Workspace Items:

  • Warehouse

  • Lakehouse

  • Notebook

  • Pipeline

  • Semantic Model

  • Report

  • Dataflow Gen2

Any guidance or documentation references would be greatly appreciated! Thanks in advance.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Sukiazure007,

    Thank you for following up with the conversation. Test these APIs and check for any errors in the response. Also make sure the correct workspace, dataset, and pipeline IDs are used. These are the Fabric APIs for each of your post-deployment updates:

     

    * For Dataflow Gen2 use the PATCH Dataflow API to update the SQL Server IP in connection settings. If the new SQL Server IP requires firewall access, ensure it is whitelisted.

    Use this code : PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/dataflows/{dataflowId}

    * For Notebook update the Notebook’s Lakehouse and Warehouse references using the PATCH Notebook API.

    Use this code : PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/notebooks/{notebookId}

    And for body : {
    "properties": {
    "lakehouse": "/workspaces/{workspaceId}/lakehouses/Lakehouse2",
    "warehouse": "/workspaces/{workspaceId}/warehouses/Target_Warehouse"
    }

    }

    If connections are defined within the Notebook code, you have to update them manually.

    * For Data Pipeline use linked service. Code for that : PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/pipelines/{pipelineId}/linkedservices/{linkedServiceId}

    For body : {
    "properties": {
    "connectionString": "Server=NEW_SQL_SERVER;Database=NEW_DATABASE;"
    }
    }

     

    If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

    Best Regards,
    Hammad.
    Community Support Team

     

    If this post helps then please mark it as a solution, so that other members find it more quickly.

    Thank you.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Sukiazure007,

    Thanks for reaching out to the Microsoft fabric community forum.

     

    It looks like you are facing issue after deploying Notebooks and other Fabric items using the updateFromGit API, the connections are still pointing to the Dev environment, and you need to update them for UAT or PROD.

    Answering to your connection update query typically, the following workspace items may have environment specific connections:

    * Warehouse & Lakehouse may have connection strings pointing to Dev databases.

    * Notebooks ciuld reference Dev storage or Lakehouses.

    * Pipelines may include linked services that need updating.

    * You can check data sources of Semantic models may still point to Dev.

    * You may need modifications in Dataflow Gen2 source connections.

     

    For the second query you can use the GET connections API to list all connections in your workspace and then update connections dynamically. Like for Warehouse/Lakehouse update the connection string using the PATCH connections API or for notebooks modify references to the correct Lakehouse or external storage. In case of pipelines you can adjust linked services via the PATCH linked services API and for Semantic Models you can use the Power BI REST API to update dataset connections. Dataflow Gen2 can be modify source connections via parameterized updates.

     

    In case of best practices you can automate post deployment connection updates using a script and try to maintain environment specific workspaces.

     

    For more details, you can refer to Fabric API documentation: Microsoft Fabric REST APIs for automation and embedded analytics - Microsoft Fabric REST APIs | Microsoft Learn

     

     

    If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

    Best Regards,
    Hammad.
    Community Support Team

     

    If this post helps then please mark it as a solution, so that other members find it more quickly.

    Thank you.

  • Sukiazure007's avatar
    Sukiazure007
    Regular Visitor

    Thank you for your response.

    Here’s a summary of the required post-deployment updates. Could you please advise on which API is best suited for each task? I am currently testing the APIs, but they are not returning the expected results.

    1. Data Flow Gen2 – Update the SQL Server IP in the connection settings.

    2. Notebook – Assign Lakehouse2 to a specific workspace and update the Warehouse to a designated workspace.

    3. Data Pipeline – Configure semantic connections for the specified workspace.

    Your guidance on the appropriate APIs for each task would be greatly appreciated.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Sukiazure007,

      Thank you for following up with the conversation. Test these APIs and check for any errors in the response. Also make sure the correct workspace, dataset, and pipeline IDs are used. These are the Fabric APIs for each of your post-deployment updates:

       

      * For Dataflow Gen2 use the PATCH Dataflow API to update the SQL Server IP in connection settings. If the new SQL Server IP requires firewall access, ensure it is whitelisted.

      Use this code : PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/dataflows/{dataflowId}

      * For Notebook update the Notebook’s Lakehouse and Warehouse references using the PATCH Notebook API.

      Use this code : PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/notebooks/{notebookId}

      And for body : {
      "properties": {
      "lakehouse": "/workspaces/{workspaceId}/lakehouses/Lakehouse2",
      "warehouse": "/workspaces/{workspaceId}/warehouses/Target_Warehouse"
      }

      }

      If connections are defined within the Notebook code, you have to update them manually.

      * For Data Pipeline use linked service. Code for that : PATCH https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/pipelines/{pipelineId}/linkedservices/{linkedServiceId}

      For body : {
      "properties": {
      "connectionString": "Server=NEW_SQL_SERVER;Database=NEW_DATABASE;"
      }
      }

       

      If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

      Best Regards,
      Hammad.
      Community Support Team

       

      If this post helps then please mark it as a solution, so that other members find it more quickly.

      Thank you.