Muokkaa

Jaa


Linter rule - simplify interpolation

This rule finds syntax that uses string interpolation when it isn't needed.

Linter rule code

Use the following value in the Bicep configuration file to customize rule settings:

simplify-interpolation

Solution

Remove any uses of string interpolation that isn't part of an expression to combine values.

The following example fails this test because it just references a parameter.

param AutomationAccountName string

resource AutomationAccount 'Microsoft.Automation/automationAccounts@2023-11-01' = {
  name: '${AutomationAccountName}'
  ...
}

You can fix it by removing the string interpolation syntax.

param AutomationAccountName string

resource AutomationAccount 'Microsoft.Automation/automationAccounts@2023-11-01' = {
  name: AutomationAccountName
  ...
}

Optionally, you can use Quick Fix to remove the string interpolation syntax:

The screenshot of Simplify interpolation linter rule quick fix.

Next steps

For more information about the linter, see Use Bicep linter.