Azure / Azure/template-analyzer
[BUG] BPA does not handle parameters with reference to Azure key vault
- Dominant language
- C#
- Stars
- 143
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
I have this below template. The adminPassword parameter is supposed to reference the Azure Key Vault to avoid storing sensitive information in parameters, but BPA doesn't recognize the reference key.
```
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminLogin": {
"type": "string",
"defaultValue": "ghuser"
},
"adminPassword": {
"type": "securestring",
"reference": {
"keyVault": {
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/defaultString3/providers/Microsoft.KeyVault/vaults/defaultString1"
},
"secretName": "defaultString2"
}
},
"location": {
"type": "string",
"defaultValue": "westus2"
}
},
"variables": {
"sqlServerName": "[concat('sql-', uniqueString(resourceGroup().id, 'sql'))]"
},
"resources": [
{
"type": "Microsoft.Sql/servers",
"apiVersion": "2021-02-01-preview",
"name": "[variables('sqlServerName')]",
"location": "[parameters('location')]",
"properties": {
"administratorLogin": "[parameters('adminLogin')]",
"administratorLoginPassword": "[parameters('adminPassword')]"
}
}
],
"outputs": {}
}
```
Error Message:
fail: TemplateAnalyzerCli[0] An exception occurred while analyzing a template Microsoft.Azure.Templates.Analyzer.Core.TemplateAnalyzerException: Error while processing template. ---> Azure.Deployments.Templates.Exceptions.TemplateParsingException: Could not find member 'reference' on object of type 'TemplateInputParameter'.
### Expected behavior
BPA should be able to recognize the parameter format of having a reference to the Azure Key Vault
### Reproduction Steps
Having any parameter that uses "reference" as opposed to the typical "defaultValue" key raises an error.
### Environment
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.