How to install nuget packages from ADLS to synapse notebooks ?

Radha Pusarapu (Ernst & Young LLP) 31 Reputation points Microsoft Vendor


Previously in our project we have used #r command to install the nuget packages.
But due to private endpoint restrictions we are unable to install directly.

Can anyone help me how can I use the nuget packages from ADLS primary storage to Synapse notebooks please

Thanks and Regards,
Radha Pusarapu

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,121 questions
{count} votes

1 answer

Sort by: Most helpful
  1. BhargavaGunnam-MSFT 23,931 Reputation points Microsoft Employee

    Hi @Radha Pusarapu (Ernst & Young LLP) ,

    Sorry for the delayed response.

    If your NuGet packages are already uploaded to the Synapse Primary Gen2 account, you can install them using the notebook.

    Here are the Steps:

    1) upload file to primary gen2 storage

    For this, you can use Azure storage explorer or Azure portal to upload the nuget package

    2) copy your file to the synapse session

    Here is the command

      /bin/bash -c " hdfs dfs -get /nuget/nuget.sample.package. /tmp/nuget.sample.package."  

    Here, I have uploaded the sample NuGet package to the workspace's default account root container named nuget.
    The root container is automatically available to the session runtime.

    With the package file in a usable location, we need to copy it to the session’s local file system. The underlying location path changes every time you create a new session. The /tmp folder is always accessible to the session.

    3) update the package reference location

    #i "/Tmp"   

    When it runs successfully, you will receive the below message

    Restore sources

    4) install the package

     #r "nuget:nuget.sample.package."  

    Please let me know if you have any questions here.