我正在尝试从 Azure RM powershell 脚本将 Cosmos DB 帐户的索引策略设置为无,但没有运气。
$tableProperties = @{
resource=@{ id=$table; indexingPolicy= @{indexingMode="none"; automatic = "false"; includedPaths = "[]"; excludedPaths = "[]" } };
options=@{ Throughput= 500 }
}
Set-AzureRmResource -ResourceType $tableResourceType `
-ApiVersion $apiVersion -ResourceGroupName $resourceGroupName `
-Name $tableResourceName -PropertyObject $tableProperties -Force
Cosmos DB 中的索引策略节点
{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/*"
}
],
"excludedPaths": [
{
"path": "/\"_etag\"/?"
}
]
}
更新:尝试:
$containerResourceType = "Microsoft.DocumentDb/databaseAccounts/tables"
$containerName = $destinationStorageName+"/"+ $table
$containerGet = Get-AzResource -ResourceType $containerResourceType `
-ApiVersion $apiVersion -ResourceGroupName $resourceGroupName `
-Name $containerName | Select-Object -ExpandProperty Properties
$containerProperties = @{
"resource"=@{
"id"=$containerGet.resource.id;
"indexingPolicy"=@{"indexingMode"="none"}
}
}
Set-AzResource -ResourceType $containerResourceType `
-ApiVersion $apiVersion -ResourceGroupName $resourceGroupName `
-Name $containerName -PropertyObject $containerProperties -Force
没运气