Skip to content

Allow roleDefinitions in resource ID lint rule#19888

Open
nkgotcode wants to merge 2 commits into
Azure:mainfrom
nkgotcode:fix/roledefinitions-resource-id
Open

Allow roleDefinitions in resource ID lint rule#19888
nkgotcode wants to merge 2 commits into
Azure:mainfrom
nkgotcode:fix/roledefinitions-resource-id

Conversation

@nkgotcode

@nkgotcode nkgotcode commented Jun 17, 2026

Copy link
Copy Markdown

Description

Fixes #19445.

Allows the use-resource-id-functions linter rule to recognize roleDefinitions(...).id as an allowed roleDefinitionId value. This avoids a false positive for the built-in roleDefinitions helper while preserving the existing resource ID validation for other expressions.

Validation:

  • PATH="$PWD/../.dotnet:$PATH" DOTNET_ROOT="$PWD/../.dotnet" DOTNET_CLI_TELEMETRY_OPTOUT=1 dotnet build src/Bicep.Core.UnitTests/Bicep.Core.UnitTests.csproj --no-restore
  • PATH="$PWD/../.dotnet:$PATH" DOTNET_ROOT="$PWD/../.dotnet" DOTNET_CLI_TELEMETRY_OPTOUT=1 dotnet run --project src/Bicep.Cli -- lint repro-oss-1557/main.bicep

Checklist

Microsoft Reviewers: Open in CodeFlow

@nkgotcode

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@nkgotcode

Copy link
Copy Markdown
Author

CLA agreement posted above; confirming here that I agree as an individual contributor.

@anthony-c-martin anthony-c-martin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

@anthony-c-martin anthony-c-martin enabled auto-merge (squash) June 18, 2026 16:11
@nkgotcode

Copy link
Copy Markdown
Author

The PR compliance job is failing because no docs label is applied: Check for Docs label requires either 📘 Docs Needed or 📘 Docs Not Needed. Could a maintainer apply the appropriate docs label?

@anthony-c-martin

Copy link
Copy Markdown
Member

@nkgotcode there are some test failures - I suspect you probably just need to update baselines. See https://github.com/Azure/bicep/blob/main/CONTRIBUTING.md#updating-test-baselines

auto-merge was automatically disabled June 18, 2026 16:41

Head branch was pushed to by a user without write access

@nkgotcode

Copy link
Copy Markdown
Author

Pushed 2687fa6 to update src/Bicep.Core.Samples/Files/baselines/InvalidResources_CRLF/main.diagnostics.bicep so the four use-resource-id-functions baseline diagnostics include roleDefinitions. Verified with dotnet test src/Bicep.Core.IntegrationTests/Bicep.Core.IntegrationTests.csproj --filter "FullyQualifiedName~SemanticModelTests.ProgramsShouldProduceExpectedDiagnostics" --no-restore --logger "console;verbosity=minimal": Passed 3,392, failed 0.

@anthony-c-martin anthony-c-martin enabled auto-merge (squash) June 18, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

roleDefinitions doesn't comply with use-resource-id-functions linter rule

2 participants