Azure Resource Manager templates define parameters as a way to reuse templates in different environments. Secure parameters (secure strings and secure objects) should not be assigned a default value.
Parameters with the type securestring and secureObject are designed to pass sensitive data to the resources being
deployed. Unlike other data types, they cannot be accessed after the deployment is completed. They can neither be logged nor used as an output.
Secure parameters can be assigned a default value which will be used if the parameter is not supplied. This default value is not protected and is stored in cleartext in the deployment history.
If the default value contains a secret, it will be disclosed to all accounts that have read access to the deployment history.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"secretValue": {
"type": "securestring",
"defaultValue": "S3CR3T"
}
}
}
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"secretValue": {
"type": "securestring"
}
}
}
@secure() param secureStringWithDefaultValue string = 'S3CR3T' // Noncompliant
@secure() param secureString string