Azure / Azure/bicep

Deployment Pane: secure param doesn't pass validation

Open
#14,534 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

My bicep script is like the following.

```bicep
@secure()
param something string

resource test 'Microsoft.Storage/storageAccounts@2023-05-01' = {
name: 'testtesttest'
location: resourceGroup().location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
tags: {
sometag: something
}
}
```
Note the param `something` is decorated by `secure()`.

Then open the script file in VS Code and show the Deployment Pane. Put "abc" for the param "something" and click the "Validate" action button, then the following error is returned

```json
{
"code": "InvalidTemplate",
"message": "Deployment template validation failed: 'The value for the template parameter 'something' at line '1' and column '278' is not provided. Please see https://aka.ms/arm-create-parameter-file for usage details.'.",
"additionalInfo": [
{
"type": "TemplateViolation",
"info": {
"lineNumber": 1,
"linePosition": 278,
"path": "properties.template.parameters.something"
}
}
]
}
```

Here's screenshot:

![Screenshot 2024-07-12 122658](https://github.com/user-attachments/assets/9f688973-003f-46b5-a7a5-2a3fab30fc7f)

Note that if I remove the `secure` decoration, then the validation can pass. But that's not what I want.

Besides, the `secure` input is not well-supported in the Deployment Pane: the input is not masked but showed clearly as plain text.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue from the supplied Bicep script in VS Code's Deployment Pane: enter a value for the @secure() parameter and select Validate. Compare this with an undecorated parameter and inspect how the pane handles the secure input; done means validation accepts the supplied value and the secure value is masked rather than shown as plain text.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, vscode
Domain
cloud, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.