1

I am writing a PowerShell script where I need to create multiple Cosmos DB Containers using the SQL api.

I already enable analytical storage when creating the Cosmos DB Account :

New-AzCosmosDBAccount -ResourceGroupName $resourceGroupName `
    -Location $locations -Name $cosmosAccountName `
    -ApiKind $apiKind -EnableAutomaticFailover:$true `
    -DefaultConsistencyLevel $consistencyLevel `
    -MaxStalenessIntervalInSeconds $maxStalenessInterval `
    -MaxStalenessPrefix $maxStalenessPrefix `
    -EnableAnalyticalStorage $true

I then create a Cosmos DB SQL Database and follow by creating the containers. I would like to enable analytical storage using -AnalyticalStorageTtl -1 like this:

New-AzCosmosDBSqlContainer `
    -ResourceGroupName $resourceGroupName `
    -AccountName $cosmosAccountName `
    -DatabaseName $databaseName `
    -Name $cosmosDbContainerName1 `
    -PartitionKeyKind Hash `
    -PartitionKeyPath $partitionKeyPath `
    -AnalyticalStorageTtl -1

But I get an error saying "-AnalyticalStorageTtl -1 is not recognized as a cmdlet[...]". This parameter is not available on the PowerShell cmdlet. However it is available using this Azure CLI command.

Am I missing something or is this parameter not available with the PS cmdlet? Are there any workarounds with PowerShell?

1 Answers1

0

Thanks for reporting this. I checked and this indeed was missed in the Cosmos DB PowerShell cmdlets. A Pull Request has been submitted to correct this and it should appear in the next customer release on Jan 19. --Thanks.

Mark Brown
  • 8,113
  • 2
  • 17
  • 21
  • Thank you for your prompt attention to this matter. In the meantime, I use the Azure CLI command in the .ps1 script as a workaround : az cosmosdb sql container create – Vehid Metovic Jan 08 '21 at 16:31