【问题标题】:How to install packages in Azure Synapse C# notebooks?如何在 Azure Synapse C# 笔记本中安装包?
【发布时间】:2021-12-05 09:21:44
【问题描述】:

我需要使用几个包在 C# 中的 Synapse 中运行笔记本。运行下面的sn-p,报错:

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?)

我参考了this文档并尝试使用以下代码安装包:

#r "nuget: Azure.Storage.Blobs, 12.10.0"

我收到以下错误:

Installing package Microsoft.Azure.Storage.Blobs, version 12.10.0...Installing package Microsoft.Azure.Storage.Blobs, version 12.10.0....../tmp/nuget/8572--6c519d5e-0a47-4b01-8cdb-d3d9d5a2562c/Project.fsproj : error NU1101: Unable to find package Microsoft.Azure.Storage.Blobs. No packages exist with this id in source(s): https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json, nuget.org

是否可以在 Synapse Notebooks 中使用这些包?

【问题讨论】:

    标签: c# .net nuget azure-synapse


    【解决方案1】:

    我们已经在本地环境中进行了测试,方法是在 azure synapse 分析工作区中创建 C# 笔记本,然后创建 apache spark 池。

    我们已经成功安装了以下软件包

    #r "nuget: Azure.Storage.Blobs, 12.10.0" 
    #r "nuget:Microsoft.IdentityModel.Clients.ActiveDirectory,5.2.9"
    #r "nuget:Azure.Storage.Common,12.9.0"
    #r "nuget:Azure.Security.KeyVault.Secrets,4.3.0-beta.2"
    

    这是参考输出屏幕截图。

    发布安装后,你可以使用关键字using,如下所示:

    我们没有找到以下任何要安装的 nugget 包

    using Microsoft.Azure.Storage.Auth;
    using Microsoft.Azure;
    

    对于存储,您还可以安装 Azure.Storage.Common nugget package,其中包括 Azure Blob(对象)、Azure Data Lake Storage Gen2、Azure 文件和 Azure 队列库。

    using Microsoft.Azure.KeyVault; 这个金块包被弃用了一个更新的包可用Azure.Security.KeyVault.Secrets 根据您使用的 Key Vault 的功能(密钥、秘密或证书),请使用以下库之一:

    • Azure.Security.KeyVault.Secrets

    • Azure.Security.KeyVault.Keys

    • Azure.Security.KeyVault.Certificates

    这里是用于 Azure 突触分析 SDK 库的 git hub link

    【讨论】:

    • 嗨,我检查了 Azure.Storage.Blobs 包,但它似乎没有客户端加密类。你知道我可以使用哪些未弃用但允许我使用信封技术进行客户端加密解密的包吗?
    • 基于 Azure documentationAzure.Storage.Blobs 支持客户端加密它有一个名为 blobclient 选项的类在该类下你有一个名为 EncryptionScope 的属性(获取要在制作时使用的加密范围请求)。
    • 这里是Azure storage client libraries for .Net的参考文档
    猜你喜欢
    • 2022-07-27
    • 2022-12-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-11
    • 2022-08-04
    • 1970-01-01
    • 2022-06-16
    • 1970-01-01
    相关资源
    最近更新 更多