【问题标题】:How do I pass multiple parameter file in a power shell如何在powershell中传递多个参数文件
【发布时间】:2018-05-02 07:00:12
【问题描述】:

我正在尝试部署 ARM 模板。

这里是模板和参数文件路径:

 [string]
 $templateFilePath = "C:\Users\Desktop\template_abc.json",

 [string]
 $parametersFilePath = "C:\Users\Desktop\parameters_xyz.json"
)

Deployment commands:

Write-Host "Starting deployment...";
if(Test-Path $parametersFilePath) {
    New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath -TemplateParameterFile $parametersFilePath;
} 

else {
    New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath;
}

我想在我的部署中再添加一个参数文件,例如:parameters_lmn.json,如何在一个部署中同时容纳 xyz 和 lmn 参数文件?

【问题讨论】:

  • 您是否要将多个值传递给$templateFilePath 和 $parametersFilePath?

标签: powershell azure arm-template


【解决方案1】:

您可以使用https://powersnippets.com/join-object/ 来合并两个 json 对象。 您需要决定哪个参数文件覆盖另一个文件,以防两者都定义相同的参数。

【讨论】:

    猜你喜欢
    • 2019-06-04
    • 1970-01-01
    • 2011-06-26
    • 2021-09-18
    • 2020-12-27
    • 2023-01-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多