如何使用secureObject或链接的ARM模板SecureString的返回

问题描述 投票:0回答:1

我如何使用从一个链接ARM模板返回返回securestringsecureObject的价值?

例如,一个孩子挂模板命名CreateStorage

  1. 创建Azure存储帐户
  2. 该帐户创建BLOB容器
  3. 创建容器中的SAS关键
  4. 返回模板outputs部分SAS键。

例如在模板中输出返回SAS:

"outputs": {
    "createdContainerSas": {
        "type": "string",
        "value": "[concat('https://', variables('storageAccountName'), '.blob.core.windows.net/', variables('containerName'), '?', listServiceSas(variables('storageAccountName'), '2018-07-01', variables('importSasInputs')).serviceSasToken)]"
    }
}

然后主模板将添加SAS关键KeyVault,以便它可以通过应用程序的其余部分使用。主模板得到值如下:

"value": "[reference('CreateStorage').outputs.createdContainerSas.value]"

问题是,作为string这意味着它出现在Azure中明文目前SAS键返回部署UI。

但是,当我改变返回的对象要么securestringsecureObject的类型,那么当createdContainerSas.value被调用时,遇到如下错误:

{\r\n \"code\": \"InvalidTemplate\",\r\n \"message\": \"Unable to process template language expressions for resource '/subscriptions/<my-subscription-id>/resourceGroups/<my-resource-group>/providers/Microsoft.Resources/deployments/CreateKeyVault' at line '310' and column '9'. 'The language expression property 'value' doesn't exist, available properties are 'type'.'\"\r\n }

所以.value财产似乎并没有从孩子挂ARM模板返回securestringsecureObject时存在。

https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-templates-outputs微软文档说

输出值支持相同类型的作为模板的输入参数。

两者securestringsecureObject工作正常作为模板,输入参数,所以我必须做一些错误的。

我如何使用从一个链接ARM模板返回返回securestringsecureObject的价值?

azure arm-template securestring azure-template
1个回答
3
投票

SecureString的\ secureObject类型从输入\输出删去。你不能“搞定”他们。他们只是被传递,仅此而已。这就是为什么被称为secure。他们没有被任何地方记录下来。没有真正的解决办法。

在你的情况,你随便拉在您需要的按键,你没有拉他们在嵌套模板,并将其传递给父模板。

© www.soinside.com 2019 - 2024. All rights reserved.