title | description | ms.topic | ms.custom | ms.date |
---|---|---|---|---|
Linter rule - no unused existing resources |
Linter rule - no unused existing resources |
reference |
devx-track-bicep |
03/20/2024 |
This rule finds existing resources that aren't referenced anywhere in the Bicep file.
Use the following value in the Bicep configuration file to customize rule settings:
no-unused-existing-resources
To reduce confusion in your template, delete any existing resources that are defined but not used. This test finds any existing resource that isn't used anywhere in the template.
The following example fails this test because the existing resource stg is declared but never used:
resource stg 'Microsoft.Storage/storageAccounts@2022-09-01' existing = {
name: 'examplestorage'
}
Use Quick Fix to remove the unused existing resource.
:::image type="content" source="./media/linter-rule-no-unused-existing-resources/linter-rule-no-unused-existing-resources-quick-fix.png" alt-text="The screenshot of No unused existing resources linter rule quick fix.":::
For more information about the linter, see Use Bicep linter.