gpt4 book ai didi

azure - 是否可以在ARM模板中创建documentDB数据库和帐户

转载 作者:行者123 更新时间:2023-12-03 00:51:14 24 4
gpt4 key购买 nike

在 Azure 门户中,可以在创建流分析作业输出的步骤中创建 documentDB 数据库和集合。使用 ARM 模板创建流作业和输出时是否可以执行相同的操作?

我发现只能使用 ARM 模板创建 documentDB 帐户作为资源,但是是否可以在设置作业输出的同时创建数据库和集合,就像在门户中一样?

最佳答案

根据我的经验,目前不支持在 ARM 模板中创建 documentDB 数据库和集合。我将与 Azure 团队确认。如果有任何反馈,我会在这里发布。

我的解决方法是我们可以使用 REST API要做到这一点。如果 documentDB 数据库和集合存在,那么我们可以通过 ARM 模板使用 documentDb 数据库和集合创建作业的输出。

 {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.1.0.0",
"parameters": {
"databaseAccountName": {

"type": "string",

"metadata": {

"description": "The DocumentDB database account name."

}

},
"dbname": {

"type": "string",

"metadata": {

"description": "The database name"

}
},
"collectionname": {

"type": "string",

"metadata": {

"description": "collectionname"

}

},
"streamAnalyticsJobName": {
"type": "string",
"minLength": 3,
"maxLength": 63,
"metadata": {
"description": "Stream Analytics Job Name, can contain alphanumeric characters and hypen and must be 3-63 characters long"
}
},
"numberOfStreamingUnits": {
"type": "int",
"minValue": 1,
"maxValue": 48,
"allowedValues": [
1,
3,
6,
12,
18,
24,
30,
36,
42,
48
],
"metadata": {
"description": "Number of Streaming Units"
}
}
},
"variables": {

"offerType": "Standard"

},
"resources": [
{
"type": "Microsoft.StreamAnalytics/StreamingJobs",
"apiVersion": "2016-03-01",
"name": "[parameters('streamAnalyticsJobName')]",
"location": "[resourceGroup().location]",
"properties": {
"sku": {
"name": "Standard"
},
"outputErrorPolicy": "stop",
"eventsOutOfOrderPolicy": "adjust",
"eventsOutOfOrderMaxDelayInSeconds": 0,
"eventsLateArrivalMaxDelayInSeconds": 5,
"dataLocale": "en-US",
"inputs": [],
"Outputs": [
{
"Name": "relateddb",
"Properties": {
"DataSource": {
"Properties": {
"AccountId": "[parameters('databaseAccountName')]",
"AccountKey": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('databaseAccountName')), '2015-11-06').primaryMasterKey]",
"CollectionNamePattern": "[parameters('collectionname')]",
"Database": "[parameters('dbname')]",
"DocumentId": null,
"PartitionKey": null
},
"Type": "Microsoft.Storage/DocumentDB"
},
"Diagnostics": null,
"Etag": null,
"Serialization": null
}
}
],
"transformation": {
"name": "Transformation",
"properties": {
"streamingUnits": "[parameters('numberOfStreamingUnits')]",
"query": "SELECT\r\n *\r\nINTO\r\n [YourOutputAlias]\r\nFROM\r\n [YourInputAlias]"
}
}
}
}
]
}

关于azure - 是否可以在ARM模板中创建documentDB数据库和帐户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42267279/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com