代码之家  ›  专栏  ›  技术社区  ›  Richard Fuller

Azure函数,CosmosDB触发器:如何在keyvault中存储连接字符串

  •  1
  • Richard Fuller  · 技术社区  · 6 年前

    CosmosDB触发函数的基本代码是:

    [CosmosDBTrigger(
                databaseName: "databaseName",
                collectionName: "collectionName",
                ConnectionStringSetting = "string",
                LeaseCollectionName = "leases")]
    

    ConnectionStringSetting

    属性的注释表明有一种使用CosmosDBOptions的方法:

        /// Optional. A string value indicating the app setting to use as the CosmosDB connection string, if different
        /// than the one specified in the <see cref="CosmosDBOptions"/>.
    

    但目前还不清楚如何在Azure函数的上下文中使用该类。

    这可能吗?

    2 回复  |  直到 6 年前
        1
  •  3
  •   Pankaj Rawat    6 年前

    现在解决方案在Azure函数中可用

    您可以将所有密钥、机密和证书放入密钥库,并通过KeyValue URL(带Manage Identity)进行访问。使用manage Identity,您不需要在Azure函数配置中存储KeyVault凭据。

    Key Vault Secrets in Azure Function with Manage Identity

        2
  •  1
  •   Matias Quaranta    6 年前

    这个 CosmosDBOptions host.json 水平。