首页 > 解决方案 > Powershell将Json字符串传递给外部函数

问题描述

我正在尝试将一个传递JSON String给外部函数。但是,似乎无法将此视为有效论点。

以下作品完美找到的是Shell Script

old_config=`databricks clusters get --cluster-id $cluster_id`
databricks clusters edit --json "${old_config}"

但是,PowerShell中的以下抛出和错误

$OldConfig=databricks clusters get --cluster-id $ClusterID
databricks clusters edit --json "${OldConfig}"

错误

PS Azure:\>   databricks clusters edit --json "$OldConfig" --debug
HTTP debugging enabled
Usage: databricks clusters edit [OPTIONS]
Try "databricks clusters edit -h" for help.

Error: Got unexpected extra arguments (cluster terminated (inactive for 15 minutes).,    autotermination_minutes: 15,    terminated_time: 1575562085278,    spark_conf: {spark.databricks.cluster.profile: serverless,      spark.databricks.io.cache.enabled: false,      spark.databricks.repl.allowedLanguages: sql,python,r,      spark.databricks.io.cache.maxMetaDataCache: 0,      spark.databricks.delta.preview.enabled: true,      spark.driver.maxResultSize: 7GB   },    driver_node_type_id: Standard_DS4_v2,    last_state_loss_time: 1575561173235,    start_time: 1566998040228,    termination_reason: {     code: INACTIVITY,      parameters: {       inactivity_duration_min: 15     }   },custom_tags: {     cluster_name: GatewayCluster,      ResourceClass: Serverless,      cluster_id: 0828-11122-ddi3i3   },    cluster_name: GatewayCluster,    init_scripts_safe_mode: false,    state: TERMINATED,    spark_version: 5.5.x-scala2.11,    cluster_id: 0828-131400-dents910,    creator_user_name: abc@xyz.com,    default_tags: {     ClusterName: GatewayCluster,      ClusterId: 0828-11122-ddi3i3,      Vendor: Databricks,      Creator: abc@xyx.com   },    cluster_source: UI,  autoscale: {     max_workers: 20,      min_workers: 7   },    spark_context_id: 11299222 })
(.venv) Azure:/

标签: powershell

解决方案


推荐阅读