Improve Azure Sandbox defaults - #19810
Conversation
|
/deployment-test |
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19810Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19810" |
|
🚀 Deployment tests starting on PR #19810... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: 1
New issues introduced by this change (3)
| Severity | Finding |
|---|---|
src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxesExtensions.cs — PublishAsAzureSandbox can now silently do nothing when no Azure sandbox group exists (or when the… |
|
src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxContainerDeployment.cs — This condition disables the documented automatic project endpoint whenever any endpoint is… |
|
src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxEndpointPropertyValueProvider.cs — Removing the external-endpoint guard makes the existing target-port fallback apply to containers… |
What changed in this PR
Enables Azure Sandbox groups to automatically adopt workloads and adds sensible .NET HTTP/HTTPS deployment defaults.
Changes:
- Simplifies
PublishAsAzureSandboxto configure runtime options only. - Maps paired .NET endpoints to one TLS-terminated port on
8080. - Adds unit, polyglot, and Azure deployment coverage.
| File | Description |
|---|---|
AzureSandboxesExtensions.cs |
Simplifies sandbox publishing API. |
AzureSandboxContainerDeployment.cs |
Adds endpoint adoption and port merging. |
AzureSandboxEndpointPropertyValueProvider.cs |
Resolves shared deployed endpoint URLs. |
README.md |
Documents new defaults and API usage. |
AzureSandboxesTests.cs |
Adds focused unit coverage. |
AzureSandboxesDeploymentTests.cs |
Adds live .NET deployment validation. |
TypeScript/apphost.mts |
Updates generated TypeScript API usage. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The C# README example references a private workload despite private Sandbox service discovery being unsupported.
Review tier: Balanced
Findings: None
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/Aspire.Hosting.Azure.Sandboxes/README.md:34
- The minimal C# example is not deployable as shown.
apiremains private, butWithReference(api)injects its endpoints intofrontend; sandbox resolution throws for endpoints that are not exposed (AzureSandboxEndpointPropertyValueProvider.cs:184), and this README lists private service discovery as unsupported at line 119. Expose and configure the API before referencing it, or demonstrate a supported dependency while preserving the private-default example.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 43797078-ec60-4205-81cb-7cf510cb5f6e
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
An excluded sandbox group can still become the default compute environment and create an unusable deployment target.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxGroupResource.cs — This guard only suppresses the summary item; the excluded group still participates in automatic… |
This comment has been minimized.
This comment has been minimized.
Preserve main's named-port and Entra allowlist request shape while retaining the secure authenticated-port default. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 43797078-ec60-4205-81cb-7cf510cb5f6e
This comment has been minimized.
This comment has been minimized.
|
/deployment-test |
|
🚀 Deployment tests starting on PR #19810... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The minimal C# README example references a private endpoint that sandbox deployment cannot resolve.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Aspire.Hosting.Azure.Sandboxes/README.md — This advertised private-by-default example cannot deploy as written. WithReference(api) injects… |
Pre-existing issues (1)
| Severity | Finding |
|---|---|
src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxGroupResource.cs — This guard only suppresses the summary item; the excluded group still participates in automatic… View comment |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 43797078-ec60-4205-81cb-7cf510cb5f6e
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The deployment test’s ANSI normalization misses OSC hyperlinks, and the documented private-reference example cannot deploy as presented.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 2
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
tests/Aspire.Deployment.EndToEnd.Tests/AzureSandboxesDeploymentTests.cs — This removes CSI color codes but leaves OSC 8 hyperlink sequences. The CLI renders each Markdown… |
Pre-existing issues (2)
| Severity | Finding |
|---|---|
src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxGroupResource.cs — This guard only suppresses the summary item; the excluded group still participates in automatic… View comment |
|
src/Aspire.Hosting.Azure.Sandboxes/README.md — This advertised private-by-default example cannot deploy as written. WithReference(api) injects… View comment |
Suppressed comments (1)
src/Aspire.Hosting.Azure.Sandboxes/README.md:34
- This “automatic” example is not deployable if the following optional customization block is omitted.
apihas only private endpoints, butfrontend.WithReference(api)requires an endpoint URL; Sandbox creates URLs only for external endpoints, and this README also lists private service discovery as unsupported. Resolving the reference therefore fails with “not exposed by the Azure sandbox deployment target.” Either avoid the private cross-workload reference in the minimal example or make the API explicitly external with an access policy that the frontend can use.
builder.AddProject<Projects.WebFrontend>("frontend")
.WithReference(api);
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 43797078-ec60-4205-81cb-7cf510cb5f6e
|
/deployment-test |
|
🚀 Deployment tests starting on PR #19810... This will deploy to real Azure infrastructure. Results will be posted here when complete. |
Tests selector2 / 99 PR test projects · 3 PR jobs · 2 advisory-only targets, from 9 changed files. Selected PR test projects (2 / 99)
Selected PR jobs (3)
Advisory workflow impact (2)
How these were chosen — grouped by what changed🧪 🔧 🔧 🔧 🔧 🔧 🔧 🧪 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The changes alter cloud deployment, networking, authentication, and public API behavior and warrant final human review despite comprehensive coverage.
Review tier: Balanced
Findings: None
Issues resolved since last review (3)
| Severity | Finding |
|---|---|
tests/Aspire.Deployment.EndToEnd.Tests/AzureSandboxesDeploymentTests.cs — This removes CSI color codes but leaves OSC 8 hyperlink sequences. The CLI renders each Markdown… View resolved comment |
|
src/Aspire.Hosting.Azure.Sandboxes/README.md — This advertised private-by-default example cannot deploy as written. WithReference(api) injects… View resolved comment |
|
src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxGroupResource.cs — This guard only suppresses the summary item; the excluded group still participates in automatic… View resolved comment |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Pull request created: #1623
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1623 targeting Updated Note This draft PR needs human review before merging. |



Description
Azure Sandbox groups now work as compute environments without requiring every workload to opt in through
PublishAsAzureSandbox. A simple AppHost can add one sandbox group and one .NET project, and Aspire automatically assigns and deploys the project while keeping its endpoints private by default.PublishAsAzureSandboxnow configures sandbox-specific runtime options only. With one compute environment, Aspire infers the sandbox group; with multiple environments, workloads select one throughWithComputeEnvironment.Public ingress follows the standard Aspire endpoint convention and requires an explicitly external endpoint, for example through
WithExternalHttpEndpoints(). For .NET projects with paired external HTTP and HTTPS endpoints, the sandbox deployment:Coverage includes automatic private .NET project adoption, explicit paired HTTP/HTTPS endpoint translation, multiple sandbox groups with one project each, and Azure deployment E2E coverage for TLS termination and the backend HTTP port.
User-facing usage
A project is assigned automatically and remains private unless ingress is requested:
External ingress and sandbox options can be configured explicitly without passing the environment:
TypeScript AppHost:
Breaking changes
The sandbox-group parameter was removed from
PublishAsAzureSandbox. Existing callers should rely on single-environment inference or callWithComputeEnvironment(sandboxGroup)beforePublishAsAzureSandbox(options)when multiple compute environments exist.PublicEndpointReadyTimeoutwas removed fromAzureSandboxGroupOptions. Sandbox deployment no longer probes public endpoint readiness; readiness is reported by the Azure deployment operation instead.Security considerations
Automatic workload assignment does not automatically expose endpoints. Only endpoints explicitly marked external become Sandbox ports. Public Sandbox ports remain Entra-authenticated by default, and anonymous access remains opt-in through
AzureSandboxEndpointOptions.Anonymous. The Sandbox proxy terminates TLS while traffic to the container uses HTTP on the shared target port.Validation
AzureSandboxesTestspassed.Aspire.Deployment.EndToEnd.Testsbuilds successfully.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?