Skip to content

Add "placement" top-level property to fallback Az resource type - #20172

Open
Anthony Martin (anthony-c-martin) with Copilot wants to merge 5 commits into
mainfrom
copilot/add-placement-to-fallback-azure
Open

Add "placement" top-level property to fallback Az resource type#20172
Anthony Martin (anthony-c-martin) with Copilot wants to merge 5 commits into
mainfrom
copilot/add-placement-to-fallback-azure

Conversation

Copilot AI commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

The fallback Azure resource type definition used for unrecognized resource types/API versions was missing the placement top-level property (zone placement policy), which exists on the ARM side alongside zones, tags, location, etc.

Changes

  • AzResourceTypeProvider.KnownTopLevelResourceProperties: added a placement object property mirroring the ARM Placement type:
    • zonePlacementPolicy (required) — string literal union 'NotSpecified' | 'Any' | 'None' | 'Auto', widened to string as fallback
    • includeZonesstring[]
    • excludeZonesstring[]
  • WriteOnlyDeployTimeConstantPropertyNames: added placement alongside zones, since its value can be normalized/changed by the RP and shouldn't be safely read at deploy time.
  • Tests: added placement cases to TopLevelResourcePropertiesTests for both resources and modules.

Example of what now compiles without a fallback warning:

resource foo 'Some.Rp/type@2024-01-01' = {
  name: 'foo'
  placement: {
    zonePlacementPolicy: 'Any'
  }
}

Co-authored-by: anthony-c-martin <38542602+anthony-c-martin@users.noreply.github.com>
Copilot AI changed the title [WIP] Add placement to fallback Azure type definition Add "placement" top-level property to fallback Az resource type Aug 10, 2026
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Test this change out locally with the following install scripts (Action run 31451449448)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 31451449448
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 31451449448"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 31451449448
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 31451449448"

@anthony-c-martin
Anthony Martin (anthony-c-martin) marked this pull request as ready for review August 10, 2026 17:34
@anthony-c-martin

Copy link
Copy Markdown
Member

Copilot can you add a scenario test to verify a VMSS .bicep file can be authored using this functionality without generating any diangostics?

Co-authored-by: anthony-c-martin <38542602+anthony-c-martin@users.noreply.github.com>

Copilot AI commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Copilot can you add a scenario test to verify a VMSS .bicep file can be authored using this functionality without generating any diangostics?

Added Placement_property_can_be_used_to_author_a_virtual_machine_scale_set_without_generating_diagnostics in TopLevelResourcePropertiesTests.cs, backed by a new VMSS-shaped fake type (Test.Compute/virtualMachineScaleSets) in BuiltInTestTypes that mirrors the real resource shape (sku, zones, properties, placement). Note: testing against the actual Microsoft.Compute/virtualMachineScaleSets type isn't possible yet, since the published Az type schema doesn't define placement there — using it currently produces the standard BCP187 fallback-property warning (same as any other undeclared property on a real resource type) until the type is regenerated upstream in bicep-types-az. Commit 8b1f8b0 (approx) has the change.

@anthony-c-martin

Copy link
Copy Markdown
Member

Copilot fix the tests

Co-authored-by: anthony-c-martin <38542602+anthony-c-martin@users.noreply.github.com>

Copilot AI commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Copilot fix the tests

Fixed in a3fd... — two baseline diagnostics files (InvalidResources_CRLF, InvalidResourceDerivedTypes_LF) had stale BCP053 "available properties" lists that didn't include the new placement property. Updated both baselines and confirmed the full Bicep.Core.IntegrationTests suite passes (aside from pre-existing network-restricted MS Graph extension tests unrelated to this change).

Copilot fix the tests

Fixed in 2222181 — two baseline diagnostics files (InvalidResources_CRLF, InvalidResourceDerivedTypes_LF) had stale BCP053 "available properties" lists that didn't include the new placement property. Updated both baselines and confirmed the full Bicep.Core.IntegrationTests suite passes (aside from pre-existing network-restricted MS Graph extension tests unrelated to this change).

@anthony-c-martin

Copy link
Copy Markdown
Member

Copilot see latest failures

Co-authored-by: anthony-c-martin <38542602+anthony-c-martin@users.noreply.github.com>

Copilot AI commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Copilot see latest failures

Fixed in 6d1ebce — the Test Dotnet (windows-latest) (LangServer) failure was caused by two stale fixture strings in TypeStringifierTests.cs and ExpressionAndTypeExtractorTests.cs expecting the stringified resource type without the new placement property. Updated both and verified locally (TypeStringifierTests: 99/99, ExpressionAndTypeExtractorTests: 146/146 passing). The Test CLI (e2e) (osx-x64) failure is an unrelated jsonrpc.test.ts hook timeout, not related to this change.

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.

Fallback Azure type definition does not contain "placement"

2 participants