Azure / Azure/bicep

False positive for use-resource-id-functions, should not fail on resourceGroup().id or similar

Open
#8,104 5 comments 0 reactions 0 assignees View on GitHub
devdiv linter-false-positive story: linter rules
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

```bicep
param vaultName string = 'vault${uniqueString(resourceGroup().id)}'
param diskName string = 'disk${uniqueString(resourceGroup().id)}'

resource backupVault 'Microsoft.DataProtection/backupVaults@2021-01-01' existing = {
name: vaultName
}

resource backupInstance 'Microsoft.DataProtection/backupvaults/backupInstances@2021-01-01' = {
parent: backupVault
name: diskName
properties: {
policyInfo: {
policyParameters: {
dataStoreParametersList: [
{
objectType: 'AzureOperationalStoreParameters'
dataStoreType: 'OperationalStore'
resourceGroupId: resourceGroup().id // <<<<<<<<<<<<<<<<<<<<<<< SHOULDN'T FAIL BUT DOES
}
]
}
}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the use-resource-id-functions rule and reproduce the reported false positive using the Bicep snippet in this issue. The work is done when resourceGroup().id is accepted in the shown contexts while the rule continues to report the cases it is intended to catch, with coverage for the regression.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.