Forum Discussion

asankab's avatar
asankab
Icon for Helper I rankHelper I
2 years ago

Programmatic Lakehouse Shortcut Creation with an Entra Service Principal

Can someone provide me a sample code as how to create a Lakehouse shortcut with an Entra Service Principal programmatic?

5 Replies

  • Expiscornovus's avatar
    Expiscornovus
    Icon for Most Valuable Professional rankMost Valuable Professional

    Hi asankab,

     

    Yes, that should be possible via the Fabric REST API:

    https://learn.microsoft.com/en-us/rest/api/fabric/core/onelake-shortcuts/create-shortcut?tabs=HTTP

     

    Below is an example in a Power Automate cloud flow

     

    URI

    https://api.fabric.microsoft.com/v1/workspaces/@{variables('WorkspaceId')}/items/@{variables('LakehouseId')}/shortcuts

     

    Body

    {
      "name": "PowerAutomateOrdersShortcut",
      "path": "Files",
      "target": {
        "oneLake": {
          "itemId": "773faa37-826f-4f9b-830f-e2a7a23e3903",
          "path": "Tables/orders",
          "workspaceId": "@{variables('WorkspaceId')}"
        }
      }
    }

     

     

    And this is the end result in my example Lakehouse

     

    • asankab's avatar
      asankab
      Icon for Helper I rankHelper I

      Thanks Expiscornovus, I will check this and get back to you within this week!

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi asankab ,

      We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet .
      In case if you have any resolution please do share that same with the community as it can be helpful to others .
      Otherwise, will respond back with the more details and we will try to help .

  • Thank you Expiscornovus, will give a try and get back to you in the next couple of days

     

    Thanks

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi asankab ,

      I hope you got some insight. Please let us know once you tried it.
      Thank you