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

Azure functions Azure函数,CosmosDB触发器:如何在keyvault中存储连接字符串,azure-functions,azure-cosmosdb,Azure Functions,Azure Cosmosdb,CosmosDB触发功能的框架代码为: [CosmosDBTrigger( databaseName: "databaseName", collectionName: "collectionName", ConnectionStringSetting = "string", LeaseCollectionName = "leases")] 连接字符串设置仅限于此处的应用设置。我想去钥匙库抓住这个秘密

CosmosDB触发功能的框架代码为:

[CosmosDBTrigger(
            databaseName: "databaseName",
            collectionName: "collectionName",
            ConnectionStringSetting = "string",
            LeaseCollectionName = "leases")]
连接字符串设置
仅限于此处的应用设置。我想去钥匙库抓住这个秘密

属性的注释表明有一种使用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"/>.
///可选。一个字符串值,指示要用作CosmosDB连接字符串的应用程序设置(如果不同)
///而不是中指定的。
但不清楚如何在Azure函数的上下文中使用该类


这是可能的吗?

CosmosDBOptions指的是可以在
host.json
级别设置的配置


目前无法从Azure Key Vault设置连接字符串,但这是我们希望包括的一项功能。

现在该解决方案在Azure function中可用

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


我认为目前不可能。请查看此帖子:。另外,谷歌
Cosmodb-msi
你应该能找到一些有用的链接