Azure / Azure/azure-cli

[Feature Suggestion] Deployment Parameters: Allow unused paramaters in deployment

Open
#21,149 8 comments 11 reactions 0 assignees View on GitHub
act-identity-squad ARM Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Is 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
```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
```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:

```bash
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](https://github.com/Azure/bicep/issues/5771), but this place seems to be a better fit.

Kind regards :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.