ARM 模板 - 使用 Powershell 传递参数并使用秘密值

ARM Template - Passing parameters with Powershell AND use Secret values

我很确定我知道答案是 "no",但我的场景有多种要求: 我正在设计一个 ARM 模板以共享给一组系统管理员,用于将 Win 服务器部署到 Azure。

我在它周围包装了一个 PowerShell 函数,因此它可以像这样使用

New-AzureVM -vmName "test01" -OsVersion "Server 2019" 等 这将构建值并将其通过管道传递给 New-AzResourceGroupDeployment

我还需要传递秘密值以将 VM 加入域并在 VM 上使用本地管理员帐户。我相信这需要一个参数文件。

但是,如果使用参数文件,我似乎找不到在使用远程存储库时也通过 PowerShell 传递参数的方法。

我目前正在使用 Azure 容器 blob 中的模板进行测试,并使用 -templateURI 和 -templateParameterURI 引用 SAS 令牌。但是你不能在主模板中有参数文件和参数。有办法实现吗?

我想要实现的所有目标在本地回购中都没有问题 - 所以在我放弃并向系统管理员展示如何使用 Git 在本地克隆远程回购之前 - 我想我会联系社区。

I also need to pass in secret values for Joining the VM to the Domain and using a Local Admin account on the VM. I believe this requires a Parameter file.

你为什么这么认为?您可以使用 powershell 传递它们,但是您必须使用 powershell 传递所有参数(或对未传递的参数使用默认值)

However, if using a Parameter file, I cannot seem to find a way of also passing parameters via PowerShell when using a remote repo.

这个是真的

所以你可以在本地下载文件,使用本地文件并用powershell覆盖一些参数

我过去使用过密钥保管库。将密码存储在 keyvault 中,并在需要将其传递给模板时将其调用到 powershell 中的参数中。