【问题标题】:Access Azure Table Storage with Azure MSI使用 Azure MSI 访问 Azure 表存储
【发布时间】:2019-05-03 00:49:37
【问题描述】:

我最近设置了我的 .net 核心应用程序以使用 MSI(托管标识)与 Azure Blob 进行通信。

MSI 是否适用于 Azure 表存储?似乎找不到任何关于它的文档。

我正在尝试使用 MSI,因此我不必再管理我的密钥(无密钥)。

【问题讨论】:

    标签: azure .net-core azure-blob-storage azure-table-storage azure-managed-identity


    【解决方案1】:

    Azure 表存储不支持 MSI。表存储确实支持 Active Directory 访问。您可以在以下链接中找到支持 MSI 的服务...

    https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-support-msi

    托管标识在 Azure AD 中为 Azure 服务提供自动托管标识。你可以使用该标识向任何支持 Azure AD 身份验证的服务(包括 Key Vault)进行身份验证,而无需在代码中添加任何凭据。

    https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview

    【讨论】:

    • 但它在公共预览版下的列表中有“Azure 存储”。 Azure Storage下不是Azure表吗?
    • 嗯对不起,我想我很困惑。可以打开托管标识并使用它来对您的应用程序进行身份验证以使用 blob 存储 docs.microsoft.com/en-us/azure/storage/common/…。这对于表存储来说是不可能的吗?
    • There is also a role for queue, but I didn't found one for table - 将 Azure Tables 移动到 Cosmos DB 下的原因。这就是您最近没有看到对 Azure Tables 进行任何增强的原因。 Azure 存储将继续支持 Azure Tables。
    • 尝试使用 AD 帐户访问 Azure 表存储不幸地给出了错误:System.InvalidOperationException: '此服务不支持令牌凭据。 :(
    • @Rthomas529 我的意思是,至少目前对于很多应用程序来说,Cosmos DB 的 Table API 不能被视为现有 Azure 表存储的“一键式”替代品,因为存在很多不兼容性而且价格也更高。
    【解决方案2】:

    现在使用最新版本的 https://www.nuget.org/packages/Azure.Data.Tables/ (12.2.1)

    您现在可以使用类似的东西创建客户端

      var tableServiceClient = new TableServiceClient(uri, new efaultAzureCredential());
    

    确保您已在 Azure 中为用户分配了正确的权限以从资源中读取

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-29
      • 2016-12-10
      • 1970-01-01
      • 2019-11-05
      • 2020-10-10
      • 2013-01-28
      • 1970-01-01
      • 2017-02-27
      相关资源
      最近更新 更多