use*_*450 8 securestring azure azure-rm-template
如何使用返回的值securestring或secureObject从链接的 ARM 模板返回的值?
例如,一个子链接模板名为CreateStorage
outputs。例如,在模板输出中返回 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)]"
}
}
Run Code Online (Sandbox Code Playgroud)
然后,主模板会将 SAS 密钥添加到 KeyVault,以便应用程序的其余部分可以使用它。主模板获取值如下:
"value": "[reference('CreateStorage').outputs.createdContainerSas.value]"
Run Code Online (Sandbox Code Playgroud)
问题在于,当前返回的 SAS 密钥意味着string它在 Azure 部署 UI 中以纯文本形式显示。
但是,当我将返回对象的类型更改为 orsecurestring时secureObject,然后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 }
Run Code Online (Sandbox Code Playgroud)
因此,当返回或从子链接的 ARM 模板返回时,该.value属性似乎不存在。securestringsecureObject
微软文档https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-templates-outputs说
输出值支持与模板输入参数相同的类型。
和作为模板输入参数securestring都secureObject工作得很好,所以我一定做错了什么。
如何使用返回的值securestring或secureObject从链接的 ARM 模板返回的值?
输入\输出中省略 secureString\secureObject 类型。你无法“得到”它们。他们只是被传递了,仅此而已。这就是为什么它们被称为secure. 它们没有被记录在任何地方。没有真正的解决方法。
在您的情况下,您只需在需要的地方拉出键,不必将它们拉入嵌套模板并将它们传递给父模板。
| 归档时间: |
|
| 查看次数: |
4922 次 |
| 最近记录: |