Skip to content

Add ergonomic Azure subnet service-delegation API - #18728

Merged
Mitch Denny (mitchdenny) merged 10 commits into
mainfrom
dapine/subnet-service-delegation-api
Aug 6, 2026
Merged

Mitch Denny (mitchdenny) merged 10 commits into
mainfrom
dapine/subnet-service-delegation-api

Conversation

@IEvangelist

@IEvangelist David Pine (IEvangelist) commented Jul 10, 2026 •

Copy link
Copy Markdown
Member

Description

Delegating an Azure subnet to a service currently requires manually constructing an annotation with a duplicated service-name string, which is not discoverable and is error-prone:

subnet.WithAnnotation(new AzureSubnetServiceDelegationAnnotation(
    "Microsoft.ContainerInstance/containerGroups",
    "Microsoft.ContainerInstance/containerGroups"));

This adds first-class fluent helpers on IResourceBuilder<AzureSubnetResource>:

  • WithServiceDelegation(string serviceName, string? name = null) — generic helper that appends an AzureSubnetServiceDelegationAnnotation, defaulting the delegation name to serviceName so callers don't repeat the value. Follows the same last-write-wins semantics as WithDelegatedSubnet (the subnet emits only its most recent delegation).
  • WithContainerInstanceDelegation() — typed convenience wrapper that delegates the subnet to Azure Container Instances (Microsoft.ContainerInstance/containerGroups).

Usage:

var vnet = builder.AddAzureVirtualNetwork("vnet");
var subnet = vnet.AddSubnet("aci-subnet", "10.0.0.0/23")
    .WithContainerInstanceDelegation();

Existing WithDelegatedSubnet behavior and generated output are unchanged. The public API baseline (api/Aspire.Hosting.Azure.Network.cs) was updated and verified byte-identical to GenAPI output via pack.

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

Introduce fluent helpers on IResourceBuilder<AzureSubnetResource> so
delegating a subnet no longer requires manually constructing an
AzureSubnetServiceDelegationAnnotation with a duplicated service string:

- WithServiceDelegation(serviceName, name?) appends a delegation
  annotation, defaulting the delegation name to the service name.
- WithContainerInstanceDelegation() is a typed convenience wrapper that
  delegates to Microsoft.ContainerInstance/containerGroups (ACI).

Update the public API baseline and add tests covering both helpers.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings July 10, 2026 16:11
@github-actions

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 -- 18728

Or

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

@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Jul 10, 2026
@github-actions

This comment has been minimized.

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.

Pull request overview

Adds annotation-driven Azure subnet service-delegation helpers for generic services and Azure Container Instances.

Changes:

  • Adds fluent delegation APIs with XML documentation and ATS exports.
  • Adds focused annotation tests.
  • Updates the generated public API baseline.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
AzureVirtualNetworkExtensions.cs Implements delegation helpers.
AzureVirtualNetworkExtensionsTests.cs Tests helper annotation behavior.
api/Aspire.Hosting.Azure.Network.cs Records the new public APIs.

@IEvangelist
David Pine (IEvangelist) marked this pull request as draft July 10, 2026 16:20
@IEvangelist
David Pine (IEvangelist) marked this pull request as ready for review July 10, 2026 16:21
@IEvangelist

Copy link
Copy Markdown
Member Author

PR Testing Report

PR Information

Artifact Version Verification

  • Expected Commit: 1cf1eaaa4f3e1669e8c51b4d945b7f81238d372a
  • Installed CLI Version: 13.5.0-pr.18728.g1cf1eaaa
  • PR hive package: Aspire.Hosting.Azure.Network.13.5.0-pr.18728.g1cf1eaaa.nupkg
  • Status: ✅ Verified (version suffix g1cf1eaaa matches head short SHA)

Note: the initial dogfood install failed because the Build CLI (win-x64) CI job was still in progress. Retried after that job completed successfully.

Changes Analyzed

Files Changed

  • src/Aspire.Hosting.Azure.Network/AzureVirtualNetworkExtensions.cs — MODIFIED (+71): adds WithServiceDelegation(serviceName, name?) and WithContainerInstanceDelegation()
  • src/Aspire.Hosting.Azure.Network/api/Aspire.Hosting.Azure.Network.cs — MODIFIED (+6): public API baseline
  • tests/Aspire.Hosting.Azure.Tests/AzureVirtualNetworkExtensionsTests.cs — MODIFIED (+45): 3 new unit tests

Change Categories

  • Hosting integration changes (Azure.Network)
  • CLI changes
  • Dashboard changes
  • CI infrastructure changes
  • VS Code extension changes
  • Test changes

Behavior

The new helpers append an AzureSubnetServiceDelegationAnnotation. At publish time,
AzureSubnetResource.ToProvisioningEntity reads it via TryGetLastAnnotation (last-write-wins)
and emits a Bicep delegations array (name + properties.serviceName) on the subnet.
WithServiceDelegation defaults the delegation name to serviceName and guards against
null/empty serviceName; WithContainerInstanceDelegation() wraps it with
Microsoft.ContainerInstance/containerGroups.

Test Scenarios Executed

Testing method: dogfood PR CLI + PR package hive, file-based AppHost, aspire publish to
generate Bicep, then assertions on the generated vnet/vnet.bicep. Azure vnet/subnet resources
are publish-only, so generated Bicep is the meaningful observable (the PR's unit tests only
assert the annotation object, not the rendered Bicep — so this adds real end-to-end coverage).

Scenario 1: Artifact version verification

Coverage Type: Verification
Status: ✅ Passed

  • Installed CLI reports 13.5.0-pr.18728.g1cf1eaaa; hive contains the PR-built Azure.Network package.

Scenario 2: WithContainerInstanceDelegation()

Objective: Verify the typed convenience wrapper delegates to Azure Container Instances.
Coverage Type: Happy path
Status: ✅ Passed

Generated aci-subnet Bicep:

delegations: [
  {
    properties: {
      serviceName: 'Microsoft.ContainerInstance/containerGroups'
    }
    name: 'Microsoft.ContainerInstance/containerGroups'
  }
]
  • serviceName correct; delegation name defaulted to the service name. ✅

Scenario 3: WithServiceDelegation with explicit name

Objective: Verify a custom delegation name plus serviceName render correctly.
Coverage Type: Happy path
Status: ✅ Passed

Generated aca-subnet Bicep:

delegations: [
  {
    properties: {
      serviceName: 'Microsoft.App/environments'
    }
    name: 'ContainerAppsDelegation'
  }
]
  • Explicit name: 'ContainerAppsDelegation' and serviceName: 'Microsoft.App/environments'. ✅

Scenario 4: Invalid input (empty serviceName)

Objective: Verify the guard clause rejects an empty service name.
Coverage Type: Unhappy path
Status: ✅ Passed
Expected Unhappy-Path Outcome: ArgumentException + non-zero exit; no artifacts generated.

Observed:

System.ArgumentException: The value cannot be an empty string. (Parameter 'serviceName')
   at System.ArgumentException.ThrowIfNullOrEmpty(String argument, String paramName)
   at Aspire.Hosting.AzureVirtualNetworkExtensions.WithServiceDelegation(...) in
      /_/src/Aspire.Hosting.Azure.Network/AzureVirtualNetworkExtensions.cs:line 359
  • aspire publish exited with code 6. ✅

Scenario 5: Last-write-wins (boundary)

Objective: Two delegations on one subnet — only the last should render.
Coverage Type: Boundary
Status: ✅ Passed

lastwins-subnet was configured with
.WithServiceDelegation("Microsoft.Sql/managedInstances").WithServiceDelegation("Microsoft.Web/serverFarms").
Generated Bicep:

delegations: [
  {
    properties: {
      serviceName: 'Microsoft.Web/serverFarms'
    }
    name: 'Microsoft.Web/serverFarms'
  }
]
  • Only the last delegation (Microsoft.Web/serverFarms) renders; the earlier
    Microsoft.Sql/managedInstances is absent — matches WithDelegatedSubnet semantics. ✅

Summary

Scenario Status Notes
1. Version verification ✅ Passed CLI 13.5.0-pr.18728.g1cf1eaaa matches head SHA
2. WithContainerInstanceDelegation() ✅ Passed ACI serviceName + defaulted name in Bicep
3. WithServiceDelegation explicit name ✅ Passed Custom name + serviceName in Bicep
4. Empty serviceName (unhappy) ✅ Passed ArgumentException, exit code 6
5. Last-write-wins (boundary) ✅ Passed Only last delegation renders

Overall Result

✅ PR VERIFIED

The new WithServiceDelegation / WithContainerInstanceDelegation helpers compile against the
PR package, produce the correct Bicep delegations output end-to-end, default the delegation
name to the service name, honor last-write-wins semantics, and guard invalid input. Behavior of
the existing WithDelegatedSubnet path is unchanged.

Notes / Observations

  • The entire Aspire.Hosting.Azure.Network surface is [Experimental("ASPIREAZURE003")]; the
    AppHost required #pragma warning disable ASPIREAZURE003. This is expected and consistent with
    the rest of the package (not specific to this PR).

- WithServiceDelegation now uses ResourceAnnotationMutationBehavior.Replace
  so repeated calls keep a single delegation annotation (true last-write-wins
  in the app model, not just at Bicep emit time). This matches the repo's
  hosting-azure guidance for override-style annotations.
- Route WithDelegatedSubnet's subnet delegation through WithServiceDelegation
  so all delegation producers share the Replace behavior and Replace never
  encounters pre-existing duplicates. Generated Bicep is unchanged.
- Validate the delegation name (after defaulting to serviceName) so an
  explicitly empty name is rejected up front instead of emitting an invalid
  empty delegation name at deployment time.
- Add tests: repeated-call last-write-wins, empty name throws, empty
  serviceName throws.

Co-authored-by: Copilot App <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 16:37
@github-actions

This comment has been minimized.

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Exercise withServiceDelegation and withContainerInstanceDelegation in the Azure Network polyglot validation AppHosts (TypeScript, Go, Java, Python) so the generated SDK signatures (including the optional delegation name) and RPC dispatch are compiled and invoked, not just covered by C# unit tests.

Co-authored-by: Copilot App <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 17:16

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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

@github-actions

This comment has been minimized.

The Azure SQL admin deployment script and AKS AddLoadBalancer both appended
an AzureSubnetServiceDelegationAnnotation directly. On a user-supplied subnet
that already carried a delegation, this left two delegation annotations, which
later makes WithServiceDelegation/WithDelegatedSubnet throw (its Replace path
calls SingleOrDefault()).

Both producers now route through WithServiceDelegation (Replace), keeping each
subnet to a single delegation annotation. AKS still captures the displaced
service name for its deploy-time warning. The SQL publish-time FakeBuilder now
honors Replace so routing through WithServiceDelegation actually dedupes.

Adds tests covering user-delegated subnets for both producers.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 169faa4f-22f3-4188-977d-c50858dc7adb
Copilot AI review requested due to automatic review settings July 13, 2026 18:55

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.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

…port

Resolves conflicts from App Service delegated subnet support (#18738) with the
new WithServiceDelegation/WithContainerInstanceDelegation helpers, and addresses
review feedback:

- WithDelegatedSubnet keeps main's guards (reject a second delegated subnet on
  the target, and reject delegating a subnet to a different service) and routes
  its annotation append through WithServiceDelegation for shared last-write-wins
  and duplicate normalization.
- WithServiceDelegation collapses any pre-existing delegation annotations before
  appending, so Replace's SingleOrDefault never throws when a subnet already
  carries directly-appended delegations.
- WithServiceDelegation remarks reworded: the single-delegation behavior is an
  Aspire modeling choice, not an Azure limitation (Azure allows one or more).
- AKS AddLoadBalancer reads the existing delegation via LastOrDefault instead of
  SingleOrDefault so a subnet with multiple direct delegations does not throw.
- Merged both sides' tests; added coverage for collapsing pre-existing
  delegations (vnet + AKS).

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: fe88a444-9650-4bac-9e2d-041d909884ab
Copilot AI review requested due to automatic review settings July 15, 2026 13:55
@github-actions

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.

@github-actions

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.

@mitchdenny

Copy link
Copy Markdown
Member

Status update: deployment E2E validated, no regressions

Following up on my earlier comment about holding this until deployment E2E was healthy again — #18854 has merged, so I merged main into this branch (e3e3a6c243) and ran the full deployment E2E matrix against it.

Run: https://github.com/microsoft/aspire/actions/runs/30518594260
Baseline (main nightly): https://github.com/microsoft/aspire/actions/runs/30512721600

Result: 27 passed / 16 failed, and the job-by-job conclusions are identical to the main baseline — a diff across all 43 deploy jobs produced zero output. No regression introduced by this PR.

Delegation-relevant tests — all green ✅

These exercise two of the three delegation producers this PR reroutes through WithServiceDelegation:

Test Delegation path covered
VnetSqlServerInfra, TypeScriptVnetSqlServerInfra WithDelegatedSubnet → ACA Microsoft.App/environments
VnetKeyVaultInfra, VnetKeyVaultConnectivity ACA env delegated subnet
VnetStorageBlobInfra, VnetStorageBlobConnectivity ACA env delegated subnet
AppServiceStoragePrivateEndpoint, AppServiceReact WithDelegatedSubnet → Microsoft.Web/hostingEnvironments

Locally: build is clean (0 warnings / 0 errors) and the targeted unit suites pass 88/88 (AzureKubernetesEnvironmentExtensionsTests, AzureVirtualNetworkExtensionsTests, AzureSqlDeploymentScriptTests).

Remaining gap ⚠️

The third delegation producer — AKS AddLoadBalancer emitting the AGC Microsoft.ServiceNetworking/trafficControllers delegation — has no live deployment validation right now. AksAzureKubernetesEnvironmentGatewayDeploymentTests is the test that would cover it, but every AKS job fails at provision-aks in ~11s with (BadRequest) ... aka.ms/aks/badrequest (#18933), well before any Aspire-generated infrastructure is applied. Same for the other 10 AKS jobs, the 2 Kubernetes jobs and RadiusStarter. AzureResourceScope and FrontDoor also fail, likewise pre-existing on main.

So that path is currently proven only by unit tests and snapshots. No change requested here — I don't think anything in this PR needs to move. I just want the AGC delegation confirmed end-to-end once #18933 is sorted, since it's the one producer whose behaviour changed that we can't observe deployed.

My earlier merge-hold is otherwise satisfied.

@IEvangelist

Copy link
Copy Markdown
Member Author

Thanks for doing the full matrix comparison and closing the loop, Mitch. The job-for-job parity with main, together with the green delegation-relevant coverage, gives me confidence this PR isn't introducing a deployment regression.

Agreed that the remaining AGC path is an infrastructure-blocked validation gap rather than a reason to hold this PR. Once #18933 is resolved, we should rerun AksAzureKubernetesEnvironmentGatewayDeploymentTests and record the result there. Thanks for clearing the hold.

The constants class was added so app authors stop hand-writing Azure
delegation strings, but without [AspireValue] the values are never
snapped during ATS scanning, so guest SDKs (Python/TypeScript/Go/Java)
never receive them. The sibling AzureServiceTags class in
Aspire.Hosting.Azure.Network marks all of its constants this way.

The api/*.ats.txt baseline is regenerated, not hand-edited:

  aspire sdk dump --format ci --output-directory <out> \
    src/Aspire.Hosting.Azure/Aspire.Hosting.Azure.csproj

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 539ca445-ef46-4c0d-866e-26f84860e064
Copilot AI review requested due to automatic review settings August 6, 2026 03:48

@mitchdenny Mitch Denny (mitchdenny) 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.

Approving.

Deployment verified across all four delegation constants:

Constant Proven by
AppServiceEnvironments CI — AppServiceStoragePrivateEndpointDeploymentTests / AppServiceReactDeploymentTests assert the ARM delegation explicitly
ContainerAppEnvironments CI — VnetSqlServerInfra / VnetKeyVaultInfra / VnetStorageBlobInfra (ARM rejects an ACA env in an undelegated subnet, so success implies a correct value)
ContainerInstances CI — SQL admin deployment-script path in VnetSqlServerInfra*
ApplicationGatewayForContainers Manual AKS run — every AKS job is blocked by #18933 before it reaches this path

Deployment E2E run 30518594260 on the merged head was byte-for-byte identical to the main baseline (run 30512721600) — no regressions from this PR.

Because CI cannot currently reach the AGC path, I ran a manual AKS smoke test against live Azure (centralus):

Subnet      Count  State      Svc
aks-nodes   0      Succeeded
alb-public  1      Succeeded  Microsoft.ServiceNetworking/trafficControllers
aci         1      Succeeded  Microsoft.ContainerInstance/containerGroups

Cluster Running (k8s 1.35.6), ingressProfile.gatewayApi.installation: Standard, Network Contributor granted to the AGC identity on the delegated subnet, ApplicationLoadBalancer CR live in-cluster. The displacement case — subnet pre-delegated to ACI, then AddLoadBalancer — correctly collapsed to exactly one delegation, as did three chained WithServiceDelegation calls.

I pushed one commit to this branch: AzureSubnetServiceDelegations was missing [AspireValue], so its values were never snapped during ATS scanning and never reached the Python/TypeScript/Go/Java guest SDKs — meaning the magic strings this class exists to eliminate would have remained hand-written in four of five languages. The sibling AzureServiceTags marks all 15 of its constants this way. The api/*.ats.txt baseline is regenerated via aspire sdk dump --format ci, not hand-edited.

Two non-blocking follow-ups worth a look at some point:

  1. ArgumentException.ThrowIfNullOrEmpty(serviceName) accepts " ", which flows straight into Bicep as serviceName: ' ' and fails later as an opaque ARM error. ThrowIfNullOrWhiteSpace would catch it at the call site. (Confirmed empirically.)
  2. AddLoadBalancer and the SQL admin-script path silently displace an existing delegation, whereas WithDelegatedSubnet throws on the same conflict. The asymmetry is probably deliberate, but it's worth being intentional about.

Separately, #18933's root cause is a product defect rather than a test one: Standard_D2s_v5 is no longer offered in centralus, and it's hardcoded in three places (AksPipeline.cs:154, AzureKubernetesEnvironmentExtensions.cs:166 and :219). Any user calling AddAzureKubernetesEnvironment in that region fails unless they override both pools. Not this PR's problem — I'll file it separately.

@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 · 4 jobs, from 16 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 (4)

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


How these were chosen — grouped by what changed

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

🔧 src/Aspire.Hosting.Azure.AppContainers/AzureContainerAppEnvironmentResource.cs (changed source)
→ 1 directly: Aspire.Hosting.Azure.Tests
→ 6 via the project graph: Aspire.Hosting.Blazor.Tests (2 hops), Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Dotnet.Tests (2 hops), Aspire.Hosting.Radius.Tests (2 hops), Aspire.Hosting.Tests, Aspire.Playground.Tests (2 hops)

🔧 src/Aspire.Hosting.Azure/AzureSubnetServiceDelegations.cs (changed source)
→ 1 directly: Aspire.Hosting.Azure.Tests
→ 3 via the project graph: Aspire.Hosting.Azure.Kusto.Tests (2 hops), Aspire.Hosting.Docker.Tests (2 hops), Aspire.Hosting.Foundry.Tests (2 hops)

🔧 src/Aspire.Hosting.Azure.Kubernetes/AzureKubernetesEnvironmentExtensions.cs (changed source)
→ 2 directly: Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Tests

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

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

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

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

🔧 src/Aspire.Hosting.Azure/api/Aspire.Hosting.Azure.ats.txt (changed source)
→ 1 directly: Aspire.Hosting.Azure.Tests

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

🧪 tests/Aspire.Hosting.Azure.Kubernetes.Tests/AzureKubernetesEnvironmentExtensionsTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Azure.Kubernetes.Tests

🧪 tests/Aspire.Hosting.Azure.Tests/AzureSqlDeploymentScriptTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Azure.Tests

🧪 tests/Aspire.Hosting.Azure.Tests/AzureVirtualNetworkExtensionsTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Azure.Tests

Job reasons

Job Triggered by
deployment-e2e affected project Aspire.Hosting.Azure.AppContainers
extension-e2e • src/Aspire.Hosting.Azure.AppContainers/AzureContainerAppEnvironmentResource.cs, src/Aspire.Hosting.Azure.AppService/AzureAppServiceEnvironmentResource.cs, src/Aspire.Hosting.Azure.Kubernetes/AzureKubernetesEnvironmentExtensions.cs, src/Aspire.Hosting.Azure.Network/AzureVirtualNetworkExtensions.cs, src/Aspire.Hosting.Azure.Network/api/Aspire.Hosting.Azure.Network.cs, src/Aspire.Hosting.Azure.Sql/AzureSqlServerResource.cs, src/Aspire.Hosting.Azure/AzureSubnetServiceDelegations.cs, src/Aspire.Hosting.Azure/api/Aspire.Hosting.Azure.ats.txt, src/Aspire.Hosting.Azure/api/Aspire.Hosting.Azure.cs
• affected project Aspire.Hosting.Azure.AppContainers
polyglot src/Aspire.Hosting.Azure/api/Aspire.Hosting.Azure.ats.txt, tests/PolyglotAppHosts/Aspire.Hosting.Azure.Network/Go/apphost.go, tests/PolyglotAppHosts/Aspire.Hosting.Azure.Network/Java/AppHost.java, tests/PolyglotAppHosts/Aspire.Hosting.Azure.Network/Python/apphost.py, tests/PolyglotAppHosts/Aspire.Hosting.Azure.Network/TypeScript/apphost.mts
typescript-api-compat • src/Aspire.Hosting.Azure/api/Aspire.Hosting.Azure.ats.txt
• affected project Aspire.Hosting.Azure.AppContainers

Selection computed for commit 684d179.

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.

Review details

Suppressed comments (2)

src/Aspire.Hosting.Azure.Network/AzureVirtualNetworkExtensions.cs:329

  • This changes existing WithDelegatedSubnet behavior despite the PR description saying it is unchanged. Previously the method searched all delegation annotations and rejected any conflicting service; using LastOrDefault() now accepts an older conflicting annotation whenever the last annotation matches, then collapses it (as the new test explicitly demonstrates). Either preserve the existing conflict validation or document and justify this compatibility change in the PR description.
        var existingDelegation = subnet.Resource.Annotations
            .OfType<AzureSubnetServiceDelegationAnnotation>()
            .LastOrDefault();

src/Aspire.Hosting.Azure.Network/AzureVirtualNetworkExtensions.cs:380

  • The PR description and usage example promise WithContainerInstanceDelegation(), but the current public surface only adds WithServiceDelegation; the convenience method is absent from the implementation, API baseline, and all four polyglot fixtures. As written, the documented example does not compile. Restore the helper with its C# and generated-SDK coverage, or update the stated scope and example if it was intentionally removed.
    [AspireExport]
    public static IResourceBuilder<AzureSubnetResource> WithServiceDelegation(
        this IResourceBuilder<AzureSubnetResource> builder,
        string serviceName,
        string? name = null)
  • Files reviewed: 16/16 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@aspire-repo-bot

This comment has been minimized.

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#1519 targeting release/13.5.

Added a "Delegate a subnet to any Azure service" section to the Azure Virtual Network reference page documenting the new WithServiceDelegation(serviceName, name?) fluent helper and the AzureSubnetServiceDelegations well-known constants (ContainerInstances, ContainerAppEnvironments, AppServiceEnvironments, ApplicationGatewayForContainers). Also extended the existing "Virtual network integration for Azure environments" entry in the Aspire 13.5 what's-new page to mention the default-name behavior and the new constants.

Note

This draft PR needs human review before merging.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants