【发布时间】:2019-06-26 11:56:42
【问题描述】:
我正在尝试在 Azure DevOps 中设置发布管道,以使用 Azure 资源管理器模板部署 Azure 环境。我要创建的资源之一是使用 Azure Table Api 的 Cosmos DB 实例,我想为整个数据库而不是 pr 预配“帐户级别吞吐量”。桌子。我可以通过 ARM 模板使用正确的 api 创建 Cosmos DB 实例,但我无法通过模板或使用 Microsoft.Azure.Cosmos.Table api 将“帐户级别吞吐量”设置为“开启” .
我能够进行配置的唯一方法是登录 Azure 门户并手动进行。是否可以通过 ARM 模板或使用 Powershell 或 Microsoft.Azure.Cosmos.Table api 自动执行此操作?
这是我目前使用的模板
{
"type": "Microsoft.DocumentDB/databaseAccounts",
"name": "[variables('cosmosStreamDBName')]",
"apiVersion": "2016-03-31",
"location": "[parameters('location')]",
"tags": {
"defaultExperience": "Azure Table"
},
"kind": "GlobalDocumentDB",
"properties": {
"capabilities": [ { "name": "EnableTable" } ],
"consistencyPolicy": {
"defaultConsistencyLevel": "BoundedStaleness",
"maxIntervalInSeconds": 86400,
"maxStalenessPrefix": 1000000
},
"databaseAccountOfferType": "Standard",
"enableAutomaticFailover": false,
"enableMultipleWriteLocations": false,
"isVirtualNetworkFilterEnabled": false,
"virtualNetworkRules": [],
"locations": [
{
"locationName": "[parameters('location')]",
"failoverPriority": 0
}
]
}
}
这是一个示例,说明我在使用 SQL api 时如何在数据库级别配置吞吐量:
var client = new DocumentClient(
new Uri(EndpointUri),
PrimaryKey,
serializerSettings: Settings
);
var db = await client.CreateDatabaseIfNotExistsAsync(
new Database { Id = DatabaseName },
new RequestOptions() {
PartitionKey = new PartitionKey(key),
OfferThroughput = 400
}
);
【问题讨论】:
标签: azure azure-cosmosdb