powershell - 如何在powershell中传递多个参数文件

标签 powershell azure azure-rm-template

我正在尝试部署 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 参数文件?

最佳答案

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

关于powershell - 如何在powershell中传递多个参数文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50128808/

相关文章:

events - 在 DownloadProgressChanged 事件期间从 DownloadFileAsync 对事件处理程序的更新缓慢

powershell - powershell控制台:从键盘快捷方式调用命令的任何方式?

c# - 如何使用 c# 或 msbuild 显示当前构建?

azure - 有没有办法通过 Azure 功能向 Azure 服务主体发送电子邮件?

ruby - Powershell SSL 套接字客户端

svn - 如何检查从 Powershell 调用 SVN 的结果

caching - azure redis 缓存/ session 是否需要可序列化属性

azure - ARM 模板 : conditionally add to array

azure - 尝试使用 ARM 模板与现有 vnet 和子网创建逻辑应用程序,但出现委派错误

azure - ARM 模板和针对 AAD 的强制标签值验证