Parameters and variables should be named consistently to communicate intent and improve maintainability. Rename your parameter or variable to follow your project’s naming convention to address this issue.

Why is this an issue?

A naming convention in software development is a set of guidelines for naming code elements like variables, functions, and classes.
Parameters and variables hold the meaning of the written code. Their names should be meaningful and follow a consistent and easily recognizable pattern.
Adhering to a consistent naming convention helps to make the code more readable and understandable, which makes it easier to maintain and debug. It also ensures consistency in the code, especially when multiple developers are working on the same project.

This rule checks that parameter and variable names match a provided regular expression.

What is the potential impact?

Inconsistent naming of parameters and variables can lead to several issues in your code:

In summary, not adhering to a naming convention for parameters and variables can lead to confusion, errors, and inefficiencies, making the code harder to read, understand, and maintain.

How to fix it in ARM templates

First, familiarize yourself with the particular naming convention of the project in question. Then, update the name to match the convention, as well as all usages of the name. For many IDEs, you can use built-in renaming and refactoring features to update all usages at once.

Code examples

Noncompliant code example

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "storage_account_name": {
      "type": "string"
    }
  },
  "variables": {
    "string_variable": "example value"
  }
}

Compliant solution

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "storageAccountName": {
      "type": "string"
    }
  },
  "variables": {
    "stringVariable": "example value"
  }
}

How to fix it in Bicep

First, familiarize yourself with the particular naming convention of the project in question. Then, update the name to match the convention, as well as all usages of the name. For many IDEs, you can use built-in renaming and refactoring features to update all usages at once.

Code examples

Noncompliant code example

param storage_account_name string    // Noncompliant
var string_variable = 'example val'  // Noncompliant

Compliant solution

param storageAccountName string
var stringVariable = 'example val'

Resources

Documentation