gpt4 book ai didi

powershell - 在 powershell 中使用 Azure CLI 创建 CosmosDB

转载 作者:行者123 更新时间:2023-12-02 23:08:36 25 4
gpt4 key购买 nike

我正在尝试创建一个新的 cosmosdb,但在执行以下代码时出现以下错误。

az cosmosdb create --name TIC_Test
--resource-group "TIC"
--default-consistency-level Session
--locations "Central US"=0 "Central US"=0
--max-interval 5 --max-staleness-prefix 100
--enable-automatic-failover false
--enable-virtual-network false
--kind GlobalDocumentDB

错误:

az : usage: az cosmosdb create [-h] [--verbose] [--debug]
At line:2 char:1
+ az cosmosdb create --name TIC_Test --resource-group "TIC" --default- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (usage: az cosmo...bose] [--debug]:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

[--output {json,jsonc,table,tsv}] [--query JMESPATH]
--resource-group RESOURCE_GROUP_NAME --name
ACCOUNT_NAME [--locations LOCATIONS [LOCATIONS ...]]
[--tags [TAGS [TAGS ...]]]
[--kind {GlobalDocumentDB,MongoDB,Parse}]
[--default-consistency-level {Eventual,Session,BoundedStaleness,Strong,ConsistentPrefix}]
[--max-staleness-prefix MAX_STALENESS_PREFIX]
[--max-interval MAX_INTERVAL]
[--ip-range-filter IP_RANGE_FILTER [IP_RANGE_FILTER ...]]
[--enable-automatic-failover [{true,false}]]
[--capabilities CAPABILITIES [CAPABILITIES ...]]
[--enable-virtual-network [{true,false}]]
[--virtual-network-rules VIRTUAL_NETWORK_RULES [VIRTUAL_NETWORK_RULES ...]]
[--subscription _SUBSCRIPTION]
az cosmosdb create: error: list index out of range

知道错误的原因是什么吗?

我怀疑这一行,但我不确定如何指定:

 --locations "Central US"=0 "Central US"=0 

最佳答案

是的,--locations 似乎是问题所在。根据doc :

Space-separated locations in 'regionName=failoverPriority' format. E.g eastus=0 westus=1. Failover priority values are 0 for write regions and greater than 0 for read regions. A failover priority value must be unique and less than the total number of regions. Default: single region account in the location of the specified resource group.

例如,这适用于将 CentralUS 配置为读/写区域,将 EastUS 配置为读取区域:

--locations "CentralUS=0" "EastUS=1"

关于powershell - 在 powershell 中使用 Azure CLI 创建 CosmosDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51197375/

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