【发布时间】:2019-05-15 22:38:45
【问题描述】:
我知道如何使用 ARM templates 创建 CosmosDB 数据库和集合。我有一个 UDF(用户定义函数),我也想使用 ARM 模板进行部署,但它似乎不受支持。
我错过了什么吗?是否有其他方式以编程方式部署/维护 UDF?
【问题讨论】:
标签: azure azure-cosmosdb arm-template
我知道如何使用 ARM templates 创建 CosmosDB 数据库和集合。我有一个 UDF(用户定义函数),我也想使用 ARM 模板进行部署,但它似乎不受支持。
我错过了什么吗?是否有其他方式以编程方式部署/维护 UDF?
【问题讨论】:
标签: azure azure-cosmosdb arm-template
您可以考虑使用 Cosmos Db sdk 或 REST API 将 udf 部署到您的集合中。
示例代码:
string udfId = "Tax";
var udfTax = new UserDefinedFunction
{
Id = udfId,
Body = {...your udf function body},
};
Uri containerUri = UriFactory.CreateDocumentCollectionUri("myDatabase", "myContainer");
await client.CreateUserDefinedFunctionAsync(containerUri, udfTax);
【讨论】:
简单的回答 No、Stored procedures and User Defined Functions 从今天起不支持通过 Azure 资源管理模板。
【讨论】:
现在可以实现了..
"type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/userDefinedFunctions",
"apiVersion": "2019-08-01",
【讨论】: