如何在Powershell中获得Azure ARM uniqueString函数的价值

时间:2019-05-16 14:13:01

标签: azure azure-devops

有没有一种方法可以在Powershell中获取 uniqueString 返回的值。我正在使用ARM模板创建大部分环境,但是对于某些事情,我仍然需要运行 Powershell Powershell 需要了解由 uniqueString 生成的资源名称后缀。目前,我已经对这些值进行了硬编码。

此外, uniqueString 返回的值过大并严重限制了资源名称,即 espstorage 太长,无法与 uniqueString 一起使用。我正在考虑在模板中用CRC32或.Net字符串哈希值替换 uniqueString ,因为无论如何我还是要在 Powershell 中对值进行硬编码。但是在所有示例中, uniqueString 似乎是“正确”的方式。

1 个答案:

答案 0 :(得分:0)

我的subscriptionId也有类似的问题。我的解决方案是在发布中:https://stackoverflow.com/questions/56195642/is-there-a-way-to-get-the-subscriptionid-used-in-task-azure-resource-group-dep