Skip to content

Passing secrets with decorator @secure() shouldn't give an error #788

@MarcosAlanoBairesDev

Description

@MarcosAlanoBairesDev

Bicep has a decorator @secure() that makes an output be able to pass secrets.
The problem is even using it, I still get an error from ARM toolkit.
Here is the official documentation: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/outputs?tabs=azure-powershell#secure-outputs
Here is the line of code I'm using (Bicep):

@secure()
output accountKey string = storageAccount.listKeys().keys[0].value

Output in JSON:

"accountKey": {
  "type": "securestring",
  "value": "[listKeys('storageAccount', '2025-01-01').keys[0].value]"
}`

Here is the error:

   NestedTemplate [parameters('storageAccountName')] [ Lines 485 - 776 ]                                                
    [-] Outputs Must Not Contain Secrets (6 ms)                                                                         
        Output contains secret: accountKey    

Since the type is securestring, shouldn't the toolkit consider this as not an issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions