Home > Net >  How to install packages in Azure Synapse C# notebooks?
How to install packages in Azure Synapse C# notebooks?

Time:10-19

I need to use a few packages to run notebooks in Synapse in C#. Running the following snippet, I get an error:

using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Azure;
using Microsoft.Azure.Storage;
using Microsoft.Azure.Storage.Auth;
using Microsoft.Azure.Storage.Blob;
using Microsoft.Azure.KeyVault;
(1,17): error CS0234: The type or namespace name 'IdentityModel' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
(3,17): error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
(4,17): error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
(5,17): error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
(6,17): error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
(7,17): error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

I referred to enter image description here

Post the installation you can use those installed package by using the keyword using as shown in below :

enter image description here

We didn't found any of the below nugget packages to install using Microsoft.Azure.Storage.Auth; using Microsoft.Azure;

for storage you can also install Azure.Storage.Common nugget package which includes Azure Blobs (objects), Azure Data Lake Storage Gen2, Azure Files, and Azure Queues libraries .

using Microsoft.Azure.KeyVault; this nugget package got deprecated a newer package is available Azure.Security.KeyVault.Secrets Depending on what functionality of Key Vault you are using (Keys, Secrets or Certificates), please use one of the following libraries:

  • Azure.Security.KeyVault.Secrets

  • Azure.Security.KeyVault.Keys

  • Azure.Security.KeyVault.Certificates

Here is the git hub link for Azure synapse Analytics SDK libraries

CodePudding user response:

I don't think I have a full answer for you especially as it's not obvious what you are trying to achieve, however this article might help from some of your needs working with Blob data in Notebooks: https://docs.microsoft.com/en-us/azure/synapse-analytics/spark/microsoft-spark-utilities?pivots=programming-language-csharp

On review this looks like exactly what you need as there are sections on authentication and key vault access.

  • Related