@codemod/location-parameter-allowedvalues
Read-only audit of deployment templates for location parameters constrained by allowedValues lists.
What It Reports
- Scans deployment JSON and commented JSON files.
- Reports
allowedValueson string parameters whose name indicates a deployment location. - Applies to top-level template parameters and nested deployment templates.
- Leaves other parameters and deployment parameter value files unchanged.
Usage
bash
This workflow scans **/*.{json,jsonc} and uses parser-backed detection to report matching parameter definitions without editing source files.
Match Rules
- The file must look like a deployment template or parameter document.
- The codemod only inspects objects under a
parametersproperty. - The parameter name must contain
location. - The parameter definition must declare
"type": "string". - The parameter definition must contain
allowedValues.
Preserve Cases
- Non-location parameters that use
allowedValues. - Parameter value files where
parameters.<name>only containsvalue. - Location parameters that already omit
allowedValues.
Example
Before:
json
Reported finding:
location is constrained by an allowedValues list. Remove the list and use a dynamic default such as resourceGroup().location or deployment().location.
Metrics
location_parameter_allowedvalues_fileslocation_parameter_allowedvalues_findingslocation_parameters_scanned
Development
bash
License
MIT