Skip to content

[Linter] use-recent-api-versions recommends API versions that are not deployable #19143

@rgant

Description

@rgant

Bicep version
Bicep CLI version 0.34.44 (0439eb6484)

Describe the bug
There is a gap between when API version specs are published to azure-rest-api-specs (and auto-generated into bicep-types-az) and when resource providers actually deploy support for those versions. The use-recent-api-versions linter rule does not account for this gap, so it can recommend API versions that fail on deployment.

Current examples:

This is a recurring pattern. Issues for scheduledQueryRules@2023-12-01 were filed across May–October 2024 (Azure/bicep-types-az#2183, Azure/bicep-types-az#2193, Azure/bicep-types-az#2318) and remain open. That version eventually became available in the RP, but the same pattern immediately recurred with @2026-03-01. Other resource types have been affected as well, including Microsoft.ApiManagement/service (Azure/bicep-types-az#2301).

The practical impact is that users update to the linter-recommended version, deployments fail, and they must roll back and add #disable-next-line use-recent-api-versions suppressions.

Note: my bicepconfig.json uses maxAllowedAgeInDays: 45, which is more aggressive than the 730-day default. This increases the likelihood of hitting the issue, but does not change the underlying problem — the linter will recommend undeployable versions regardless of the threshold if the currently-used version is old enough.

To Reproduce

  1. Configure use-recent-api-versions with a maxAllowedAgeInDays value that flags the current version as stale
  2. Create a Bicep file with Microsoft.Search/searchServices@2025-02-01-preview
  3. Observe the linter warning recommending @2025-05-01
  4. Update to the recommended version
  5. Deploy to eastus
  6. Deployment fails with NoRegisteredProviderFound

Additional context
A possible mitigation would be for the linter rule to apply a grace period after a type version first appears in bicep-types-az before recommending it, giving resource providers time to complete deployment. Alternatively, the linter documentation could note that recommended versions may not yet be deployable in all regions.

Metadata

Metadata

Type

No type

Projects

Status

Todo

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions