:identifier_capital_plural: Parameters and variables
:identifier: parameter and variable
:identifier_plural: parameters and variables
:identifier_or: parameter or variable
:regex: ^[a-z][a-zA-Z0-9]*$

include::../introduction.adoc[]

include::../why-is-this-an-issue.adoc[]

include::../what-is-the-potential-impact.adoc[]

== How to fix it in JSON templates

include::../how-to-fix-it-description.adoc[]

=== Code examples

==== Noncompliant code example

[source,json,diff-id=1,diff-type=noncompliant]
----
{
  "$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

[source,json,diff-id=1,diff-type=compliant]
----
{
  "$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

include::../how-to-fix-it-description.adoc[]

=== Code examples

==== Noncompliant code example

[source,bicep,diff-id=2,diff-type=noncompliant]
----
param storage_account_name string    // Noncompliant
var string_variable = 'example val'  // Noncompliant
----

==== Compliant solution

[source,bicep,diff-id=2,diff-type=compliant]
----
param storageAccountName string
var stringVariable = 'example val'
----

== Resources

=== Documentation

* Microsoft - https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/best-practices#parameters[ARM template best practices]
* Microsoft - https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/best-practices#names[Best practices for Bicep]
* Microsoft - https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/variables[Variables in ARM templates]
* Microsoft - https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/parameters[Parameters in ARM templates]
* Microsoft - https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/variables[Variables in Bicep]
* Microsoft - https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/parameters[Parameters in Bicep]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

include::../parameters.adoc[]

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]
