bicep icon indicating copy to clipboard operation
bicep copied to clipboard

Securestring parameters are shown as string parameters when referencing an ARM template or bicep registry module

Open jesseve opened this issue 3 years ago • 2 comments

Bicep version v.0.16.1

Describe the bug I am referencing a module in a bicep registry that has a secure string parameter. I pass a key vault reference as parameter to the module but I receive an error: Function "getSecret" is not valid at this location. It can only be used when directly assigning to a module parameter with a secure decorator.bicep(BCP180).

I get the same error if I reference an ARM template. I put some example templates below which produce the error.

To Reproduce Steps to reproduce the behavior: bicep file contents `param location string = resourceGroup().location

resource keyvault 'Microsoft.KeyVault/vaults@2023-02-01' = { name: 'mykeyvault' location: location properties: { sku: { family: 'A' name: 'standard' } tenantId: tenant().tenantId } }

module secret 'secret.json' = { name: 'secret-deployment' params: { mySecret: keyvault.getSecret('secretname') } }`

ARM template contents: { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.16.1.55165", "templateHash": "1506764633190393492" } }, "parameters": { "mySecret": { "type": "securestring" } }, "resources": [ { "type": "Microsoft.KeyVault/vaults/secrets", "apiVersion": "2023-02-01", "name": "myotherkeyvault/mySecret", "properties": { "value": "[parameters('mySecret')]" } } ] }

Additional context Started getting this error after 3rd of April 2023.

jesseve avatar Apr 06 '23 08:04 jesseve

Also in VS Code, if I hover over the mySecret parameter in the bicep file, its type is shown as string and not secure string.

jesseve avatar Apr 06 '23 08:04 jesseve

Closing as dup of #10321. We are working on getting a release out soon with this hotfix.

alex-frankel avatar Apr 06 '23 13:04 alex-frankel