我正在编写一个 PowerShell 脚本,需要使用 SQL API 创建多个 Cosmos DB 容器。
我在创建 Cosmos DB 帐户时已启用分析存储:
New-AzCosmosDBAccount -ResourceGroupName $resourceGroupName `
-Location $locations -Name $cosmosAccountName `
-ApiKind $apiKind -EnableAutomaticFailover:$true `
-DefaultConsistencyLevel $consistencyLevel `
-MaxStalenessIntervalInSeconds $maxStalenessInterval `
-MaxStalenessPrefix $maxStalenessPrefix `
-EnableAnalyticalStorage $true
然后,我创建一个 Cosmos DB SQL 数据库,然后创建容器。 我想使用 -AnalyticalStorageTtl -1 启用分析存储,如下所示:
New-AzCosmosDBSqlContainer `
-ResourceGroupName $resourceGroupName `
-AccountName $cosmosAccountName `
-DatabaseName $databaseName `
-Name $cosmosDbContainerName1 `
-PartitionKeyKind Hash `
-PartitionKeyPath $partitionKeyPath `
-AnalyticalStorageTtl -1
但我收到一条错误消息“-AnalyticalStorageTtl -1 未被识别为 cmdlet[...]”。 此参数在 PowerShell cmdlet 上不可用。但是可以使用 this Azure CLI command. 来获取它。
我是否遗漏了某些内容,或者此参数在 PS cmdlet 中不可用? PowerShell 有任何解决方法吗?
最佳答案
感谢您报告此事。我检查了一下,Cosmos DB PowerShell cmdlet 中确实遗漏了这一点。一个Pull Request已提交纠正此问题,它应该出现在下一个 customer release 中1 月 19 日。--谢谢。
关于azure - 如何使用 PowerShell 创建启用分析存储的 Cosmos DB Sql 容器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65613460/