Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Generate Parameters command should work like the ARM one and offer a choice of both "required" and "all" parameters #7434

Closed
ChristopherGLewis opened this issue Jul 1, 2022 · 1 comment
Labels
enhancement New feature or request Needs: Triage 🔍

Comments

@ChristopherGLewis
Copy link
Contributor

Is your feature request related to a problem? Please describe.
#6601 adding generate params command is a great addition to the bicep world, however, it should work more like the ARM add parameter command.

Bicep version
Bicep CLI version 0.7.4 (5afc312)

Describe the solution you'd like
Currently, the "Generate Parameters File" command creates a parameter file with the required parameters. The ARM version of the same action is much more robust, allowing for creation of a parameter file with All or only Required parameters.

In addition, the parameter action in the ARM environment softly links the parameter file and adds code hints that show what the parameters are.

For example, given this Bicep file

param backupVaultName string
param location string

@allowed([
    'GeoRedundant'
    'LocallyRedundant'
])
param storageSettingsType string = 'LocallyRedundant'
@allowed([
    'ArchiveStore'
    'SnapshotStore'
    'VaultStore'
])
param storageSettingsDatastoreType string = 'ArchiveStore'

param tags object = {}

resource backupVault 'Microsoft.DataProtection/backupVaults@2021-01-01' = {
    name: backupVaultName
    location: location

    properties: {
        storageSettings: [
            {
                datastoreType: storageSettingsDatastoreType
                type: storageSettingsType
            }
        ]
    }
    tags: tags
}

output id string = backupVault.id

The Generate Parameter command creates this parameter file:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "backupVaultName": {
      "value": ""
    },
    "location": {
      "value": ""
    }
  }
}

The ARM parameter creation commands offer additional functionality:
image

image

image

and can include all parameters:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "backupVaultName": {
            "value": "" // TODO: Fill in parameter value
        },
        "location": {
            "value": "" // TODO: Fill in parameter value
        },
        "storageSettingsType": {
            "value": "LocallyRedundant"
        },
        "storageSettingsDatastoreType": {
            "value": "ArchiveStore"
        },
        "tags": {
            "value": {}
        }
    }
}

The ARM tooling also propagates these values to the VSCode development environment and enables additional code validation:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "backupVaultName": {
            "value": "FRED"
        },
        "location": {
            "value": "EastUS"
        },
        "storageSettingsType": {
            "value": "BADValueLocallyRedundant"
        },
        "storageSettingsDatastoreType": {
            "value": "ArchiveStore"
        },
        "tags": {
            "value": {}
        }
    }
}

image

image

Making the Bicep parameter experience work more like the ARM environment would be great. The functionality is certainly better in the ARM world.

I also believe this should be a priority for the new work in #7301 Bicep Parameters File

I believe that making the Bicep development environment work like the ARM environment would be a good thing for the community.

@ChristopherGLewis ChristopherGLewis added the enhancement New feature or request label Jul 1, 2022
@ghost ghost added the Needs: Triage 🔍 label Jul 1, 2022
@alex-frankel
Copy link
Collaborator

Duplicate of #7294 and should be resolved as part of #7126

@ghost ghost locked as resolved and limited conversation to collaborators May 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request Needs: Triage 🔍
Projects
None yet
Development

No branches or pull requests

2 participants