更新跟随者集群配置:指定包含表数组的正确语法咨询
正确的Azure CLI参数语法(PowerShell环境)
你需要调整两个关键点来解决问题:
合并
--table-level参数
不要拆分使用两个--table-level,应将tables-to-include和materialized-views-to-include放在同一个--table-level参数中,用空格分隔两组键值对。拆分使用会导致后一个参数覆盖前一个的配置,这也是你的表列表未生效的核心原因。正确指定多表列表
在PowerShell环境中,需要将包含多表的键值对用双引号括起来,避免PowerShell将逗号解析为参数分隔符。
修正后的完整命令
az kusto attached-database-configuration update ` --attached-database-configuration-name azconfig ` --cluster-name "myfollower" ` --resource-group "MY_RESOURCE_GROUP" ` --table-level "tables-to-include=table1,table2,table3,table4,table5 materialized-views-to-include=*_view"
替代方案(使用PowerShell变量)
如果表列表较长,也可以先定义变量拼接成字符串,再传入命令:
$targetTables = @("table1", "table2", "table3", "table4", "table5") $tablesList = $targetTables -join "," az kusto attached-database-configuration update ` --attached-database-configuration-name azconfig ` --cluster-name "myfollower" ` --resource-group "MY_RESOURCE_GROUP" ` --table-level "tables-to-include=$tablesList materialized-views-to-include=*_view"
注:Azure CLI的参数解析逻辑和PowerShell Cmdlet(如New-AzKustoAttachedDatabaseConfiguration)不同,后者支持直接传入PowerShell数组,而Azure CLI需要遵循基于字符串的参数格式。
内容的提问来源于stack exchange,提问作者Werner
相关产品推荐
相关产品推荐

