[Feature Suggestion] Deployment Parameters: Allow unused paramaters in deployment
See original GitHub issueIs your feature request related to a problem? Please describe
I want to deploy resources based on a params.json
file. If unused parameters are present the deployment currently fails:
InvalidTemplate - Deployment template validation failed: 'The template parameters ‘rg_tags’ in the parameters file are not valid; they are not present in the original template and can therefore not be provided at deployment time. The only supported parameters for this template are ‘name, tags’.
main.bicep
param name string
param tags object
resource storage 'Microsoft.Storage/storageAccounts@2021-06-01' = {
name: name
location: resourceGroup().location
kind: 'StorageV2'
sku: {
name: 'Standard_ZRS'
}
properties: {
accessTier: 'Cool'
}
tags: tags
}
params.json
{
"id": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"title": "Parameters",
"description": "An Azure deployment parameter file",
"type": "object",
"parameters": {
"name": {
"value": "mystoragename"
},
"rg_tags": {
"value": {
"businessowner": "tba",
"project": "tba"
}
},
"tags": {
"value": {
"application": "XYZ",
"version": "0.0.1"
}
}
}
}
Describe the solution you’d like
Basically, I want to deploy resources without having to delete parameters in the parameters file. In other words, I want to provide as many parameters in my configuration as I want, but use only a few of them in a specific deployment. Hence, I want to be able to define parameters even though they might not be used in a deployment. When I deploy a resource group, for instance, I will use my rg_tags
values from the parameters, but not the normal tags
that might be used in other deployments.
Additional context
This is the command I use:
az deployment group what-if --resource-group "MY_RESOURCE_GROUP" -f "main.bicep" --parameters "params.json"
Hope this is the right place for the suggestion. I already opened an issue here, but this place seems to be a better fit.
Kind regards 😃
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:6
Top GitHub Comments
route to service team
Hi,
maybe this is not the best solution to this request but I have written a script for the bicep deployment.
Folder Structure
config.json
params.json / params.secret.json
⚠️ put the params.secret.json in
.gitignore
deploy.py
The script…
params.json
from the root folder;params.json
file in the resource group folder, if available, both were merged:{**global, **project}
;main.bicep
file is checked for params. The deploy will run if all params are found (aparams.deployment.json
file is created and deleted afterwards. It will only contain the params frommain.bicep
)deployment commands
script file
Hope it helps! Cheers