Skip to content

Preserve Azure Bicep scope API compatibility - #19084

Merged
Sébastien Ros (sebastienros) merged 1 commit into
mainfrom
sebros/fix-bicep-scope-api
Aug 7, 2026
Merged

Preserve Azure Bicep scope API compatibility#19084
Sébastien Ros (sebastienros) merged 1 commit into
mainfrom
sebros/fix-bicep-scope-api

Conversation

@sebastienros

Copy link
Copy Markdown
Contributor

Description

#17988 made AzureBicepResourceScope.ResourceGroup nullable to represent subscription- and tenant-scoped deployments, which breaks the existing public API contract. This restores the shipped non-nullable object ResourceGroup property while keeping the new scope scenarios working.

Subscription and tenant scopes now model resource-group absence internally with HasResourceGroup. Internal publishing and provisioning paths check that state before accessing ResourceGroup, whose public getter throws when the selected scope does not target a resource group. Focused tests cover resource-group, subscription, and tenant behavior.

Validated with the targeted Azure hosting scope tests and a Release build of Aspire.Hosting.Azure.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a4388e40-626f-4e1a-b980-bf079acdd8d5
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19084

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19084"

@github-actions github-actions Bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Aug 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Tests selector (audit mode)

The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement.

11 / 100 test projects · 3 jobs, from 7 changed files.

Selected test projects (11 / 100)

Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Kusto.Tests, Aspire.Hosting.Azure.Tests, Aspire.Hosting.Blazor.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Docker.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.Foundry.Tests, Aspire.Hosting.Radius.Tests, Aspire.Hosting.Tests, Aspire.Playground.Tests

Selected jobs (3)

deployment-e2e, extension-e2e, typescript-api-compat


How these were chosen — grouped by what changed

⚠️ 10 of the 11 selected test projects come from a single change — src/Aspire.Hosting.Azure/AzureBicepResource.cs.

🔧 src/Aspire.Hosting.Azure/AzureBicepResource.cs (changed source)
1 directly: Aspire.Hosting.Azure.Tests
9 via the project graph: Aspire.Hosting.Azure.Kusto.Tests (2 hops), Aspire.Hosting.Blazor.Tests (3 hops), Aspire.Hosting.CodeGeneration.TypeScript.Tests (2 hops), Aspire.Hosting.Docker.Tests (2 hops), Aspire.Hosting.Dotnet.Tests (3 hops), Aspire.Hosting.Foundry.Tests (2 hops), Aspire.Hosting.Radius.Tests (3 hops), Aspire.Hosting.Tests (2 hops), Aspire.Playground.Tests (2 hops)

🧪 tests/Aspire.Hosting.Azure.Tests/AzureBicepResourceScopeTests.cs (changed test)
1 directly: Aspire.Hosting.Azure.Tests
1 via the project graph: Aspire.Hosting.Azure.Kubernetes.Tests

🔧 src/Aspire.Hosting.Azure/AzureBicepResourceScope.cs (changed source)
1 directly: Aspire.Hosting.Azure.Tests

🔧 src/Aspire.Hosting.Azure/AzureProvisioningResource.cs (changed source)
1 directly: Aspire.Hosting.Azure.Tests

🔧 src/Aspire.Hosting.Azure/AzurePublishingContext.cs (changed source)
1 directly: Aspire.Hosting.Azure.Tests

🔧 src/Aspire.Hosting.Azure/Provisioning/BicepUtilities.cs (changed source)
1 directly: Aspire.Hosting.Azure.Tests

🔧 src/Aspire.Hosting.Azure/Provisioning/Provisioners/BicepProvisioner.cs (changed source)
1 directly: Aspire.Hosting.Azure.Tests

Job reasons

Job Triggered by
deployment-e2e affected project Aspire.Hosting.Azure
extension-e2e src/Aspire.Hosting.Azure/AzureBicepResource.cs, src/Aspire.Hosting.Azure/AzureBicepResourceScope.cs, src/Aspire.Hosting.Azure/AzureProvisioningResource.cs, src/Aspire.Hosting.Azure/AzurePublishingContext.cs, src/Aspire.Hosting.Azure/Provisioning/BicepUtilities.cs, src/Aspire.Hosting.Azure/Provisioning/Provisioners/BicepProvisioner.cs
• affected project Aspire.Hosting.Azure
typescript-api-compat affected project Aspire.Hosting.Azure

Selection computed for commit a10efb8.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@sebastienros
Sébastien Ros (sebastienros) merged commit 44c3071 into main Aug 7, 2026
678 of 682 checks passed
@sebastienros
Sébastien Ros (sebastienros) deleted the sebros/fix-bicep-scope-api branch August 7, 2026 17:07
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.5 milestone Aug 7, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

Step 5 branch taken: docs_optional → internal_refactor

Triggered signals: none (signal_count: 0, triggered_signals: [] in signals.json).

Rationale: This PR fixes a regression introduced by an earlier change (#17988) that made AzureBicepResourceScope.ResourceGroup nullable, breaking the previously shipped public API contract. The fix restores the original non-nullable object ResourceGroup getter (throwing for subscription/tenant scopes that lack a resource group) and adds internal HasResourceGroup state to guard access. Per the PR body, "Did you add public API? No" — no new or changed public surface, no new CLI/MCP/dashboard/config surface, and no behavior change from the perspective of prior shipped documentation.

All 7 changed files are under src/Aspire.Hosting.Azure/ (internal implementation of Bicep resource scope handling) plus one new test file (tests/Aspire.Hosting.Azure.Tests/AzureBicepResourceScopeTests.cs). None are user-facing docs, READMEs, CLI resource strings, or public API baseline files (api/*.cs). A grep of src/frontend/src/content/docs/ for AzureBicepResourceScope/scope-related terms found no existing documentation of this specific compatibility detail — the Azure docs describe using resource groups at a conceptual level, not this internal scope-modeling API, so there is nothing to update or that was ever incorrectly documented.

This is an internal correctness fix (restoring prior public API shape) with no new user-facing surface — matches the internal_refactor allowlist category. No docs PR is warranted.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Analysis: Possible Flaky Test(s)

The CI build failed due to test failure(s) that appear unrelated to the PR changes. These may be flaky tests.

Suspected flaky test(s):

  • Aspire.Hosting.RemoteHost.Tests.JsonRpcAuthenticationTests.FailedAuthentication_ClosesConnection_AndPreventsFurtherCalls in job Tests / Hosting.RemoteHost / Hosting.RemoteHost (windows-latest)
    • Error: System.TimeoutException : Timed out connecting to test RPC server 'aspire-remotehost-test-b6151cb061ad419f94c5d400e8f1db4d'.
      ---- System.OperationCanceledException : The operation was canceled.
    • Stack Trace (first frames):
      at Aspire.Hosting.RemoteHost.Tests.JsonRpcAuthenticationTests.RemoteHostTestServer.ConnectToServerAsync(String socketPath, CancellationToken cancellationToken) in /_/tests/Aspire.Hosting.RemoteHost.Tests/JsonRpcAuthenticationTests.cs:line 220
         at Aspire.Hosting.RemoteHost.Tests.JsonRpcAuthenticationTests.RemoteHostTestServer.ConnectAsync() in /_/tests/Aspire.Hosting.RemoteHost.Tests/JsonRpcAuthenticationTests.cs:line 129
         at Aspire.Hosting.RemoteHost.Tests.JsonRpcAuthenticationTests.FailedAuthentication_ClosesConnection_AndPreventsFurtherCalls() in /_/tests/Aspire.Hosting.RemoteHost.Tests/JsonRpcAuthenticationTests.cs:line 58
      
    • Why likely flaky: Named-pipe RPC connection timeout in test infrastructure, unrelated to the PR's Azure Bicep scope changes (PR only modifies Aspire.Hosting.Azure files); the RemoteHost project is not touched by this PR.

Suggested actions:

  • Re-run the failed CI jobs to confirm if the failure is intermittent
  • If the test continues to fail, consider quarantining it using /quarantine-test <test name> <issue URL>
  • Search existing issues to see if this test is already known to be flaky

You can re-run the failed jobs from the workflow run page.

Adam Ratzman (adamint) pushed a commit to adamint/aspire that referenced this pull request Aug 7, 2026
PR microsoft#19084 added AzureBicepResourceScopeTests using the then-current
ForSubscription and ForTenant factories. PR microsoft#18976 merged 27 seconds later
and renamed the public factories to CreateForSubscription and
CreateForTenant after API review.

Neither PR conflicted textually on its own branch, but their combination left
the new test calling names that no longer exist on main. Update the test to
follow the shipping API shape from microsoft#18976 rather than reintroducing the old
factory names.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adam Ratzman (adamint) added a commit that referenced this pull request Aug 7, 2026
PR #19084 added AzureBicepResourceScopeTests using the then-current
ForSubscription and ForTenant factories. PR #18976 merged 27 seconds later
and renamed the public factories to CreateForSubscription and
CreateForTenant after API review.

Neither PR conflicted textually on its own branch, but their combination left
the new test calling names that no longer exist on main. Update the test to
follow the shipping API shape from #18976 rather than reintroducing the old
factory names.

Co-authored-by: adamint <adamratzman1@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants