Skip to content

Hide Azure environment when all resources use emulators - #19843

Merged
Eric Erhardt (eerhardt) merged 2 commits into
mainfrom
eerhardt-hide-azure-environment-emulators
Sep 4, 2026
Merged

Hide Azure environment when all resources use emulators#19843
Eric Erhardt (eerhardt) merged 2 commits into
mainfrom
eerhardt-hide-azure-environment-emulators

Conversation

@eerhardt

Copy link
Copy Markdown
Member

Description

AppHosts that run every Azure resource through a local emulator currently show an azure-environment resource stuck in the Not started state. This hides that control resource when the completed run-mode model has no Azure resources requiring provisioning, while keeping it visible for mixed emulator/cloud models.

The visibility decision runs during Azure resource preparation, after fluent emulator configuration is complete, and uses the existing provisionable-resource filtering.

User-facing usage

Existing emulator-only AppHosts require no changes. For example:

builder.AddAzureCosmosDB("cosmos").RunAsEmulator();
builder.AddAzureStorage("storage").RunAsEmulator();
builder.AddAzureEventHubs("eventhubs").RunAsEmulator();

The dashboard now omits azure-environment for this model. Adding any Azure resource that requires provisioning keeps azure-environment visible.

Validation:

  • AzureRunAsEmulatorModeTests (18 tests)
  • AzureResourcePreparerTests (26 tests)

Fixes #19617

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: 47b77be6-ef01-4e61-8b4e-96d0ad93b434
Copilot AI balanced review requested due to automatic review settings September 1, 2026 17:01
@github-actions

github-actions Bot commented Sep 1, 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 -- 19843

Or

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

@github-actions github-actions Bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Sep 1, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 47b77be6-ef01-4e61-8b4e-96d0ad93b434

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

Hides the Azure environment control resource for emulator-only run-mode applications while preserving it for cloud provisioning.

Changes:

  • Adds conditional Azure environment visibility.
  • Adds emulator-only and mixed-model regression tests.

Reviewed changes

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

File Description
src/Aspire.Hosting.Azure/AzureResourcePreparer.cs Hides unused Azure environments during preparation.
tests/Aspire.Hosting.Azure.Tests/AzureRunAsEmulatorModeTests.cs Verifies hidden and visible scenarios.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Tests selector

11 / 99 PR test projects · 2 PR jobs · 1 advisory-only target, from 2 changed files.

Selected PR test projects (11 / 99)

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 PR jobs (2)

extension-e2e, typescript-api-compat

Advisory workflow impact (1)

  • deployment-e2e (schedule/dispatch-only)

How these were chosen — grouped by what changed

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

🔧 src/Aspire.Hosting.Azure/AzureResourcePreparer.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/AzureRunAsEmulatorModeTests.cs (changed test)
1 directly: Aspire.Hosting.Azure.Tests
1 via the project graph: Aspire.Hosting.Azure.Kubernetes.Tests

Job reasons

Job Triggered by
deployment-e2e affected project Aspire.Hosting.Azure
extension-e2e src/Aspire.Hosting.Azure/AzureResourcePreparer.cs
• affected project Aspire.Hosting.Azure
typescript-api-compat affected project Aspire.Hosting.Azure

Selection computed for commit 4988ebf.

@github-actions

github-actions Bot commented Sep 1, 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.

@eerhardt
Eric Erhardt (eerhardt) merged commit efbfe18 into main Sep 4, 2026
207 of 210 checks passed
@eerhardt
Eric Erhardt (eerhardt) deleted the eerhardt-hide-azure-environment-emulators branch September 4, 2026 14:01
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.6 milestone Sep 4, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #1618

Generated by PR Documentation Check · auto · 54.4 AIC · ⌖ 7.92 AIC · ⊞ 19.7K

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#1618 targeting release/13.6.

Added documentation for the dashboard behavior change: Aspire now hides the azure-environment resource when every Azure resource in the app model runs as a local emulator (previously it stayed visible stuck in Not started).

  • integrations/cloud/azure/overview.mdx: new note under the Local emulators section describing when azure-environment is hidden vs. shown.
  • whats-new/aspire-13-6.mdx: new bullet under App model and AppHost → Testing, interactions, and extension points summarizing the change, cross-linked to the overview page.

Note

This draft PR needs human review before merging.

@davidfowl

Copy link
Copy Markdown
Collaborator

/backport to release/13.5

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Started backporting to release/13.5 (link to workflow run)

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

David Fowler (@davidfowl) backporting to release/13.5 failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Hide unused Azure environment resource
Using index info to reconstruct a base tree...
M	tests/Aspire.Hosting.Azure.Tests/AzureRunAsEmulatorModeTests.cs
Falling back to patching base and 3-way merge...
Auto-merging tests/Aspire.Hosting.Azure.Tests/AzureRunAsEmulatorModeTests.cs
CONFLICT (content): Merge conflict in tests/Aspire.Hosting.Azure.Tests/AzureRunAsEmulatorModeTests.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Hide unused Azure environment resource
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

@eerhardt

Copy link
Copy Markdown
Member Author

/backport to release/13.5

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Started backporting to release/13.5 (link to workflow run)

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Eric Erhardt (@eerhardt) backporting to release/13.5 failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Hide unused Azure environment resource
Using index info to reconstruct a base tree...
M	tests/Aspire.Hosting.Azure.Tests/AzureRunAsEmulatorModeTests.cs
Falling back to patching base and 3-way merge...
Auto-merging tests/Aspire.Hosting.Azure.Tests/AzureRunAsEmulatorModeTests.cs
CONFLICT (content): Merge conflict in tests/Aspire.Hosting.Azure.Tests/AzureRunAsEmulatorModeTests.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Hide unused Azure environment resource
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

Jose Perez Rodriguez (joperezr) pushed a commit that referenced this pull request Sep 9, 2026
)

Hide the unused azure-environment resource when the completed run-mode
model contains no Azure resources requiring provisioning. Keep it visible
for mixed emulator/cloud models.

(cherry picked from commit efbfe18)

Resolve the test-file conflict by preserving release/13.5's Cosmos DB
preview-emulator warning suppression alongside the new Azure environment
warning suppression.

Co-authored-by: Copilot App <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.

Hide azure-environment when all Azure resources use emulators

3 participants