Repository navigation
[release/17.0] Address API review feedback from #22185 - #22217
Jose Perez Rodriguez (joperezr) merged 3 commits into
Conversation
- Clarify Obsolete messages on legacy AddProject overloads. - Rename ParameterResource WithOptional/WithRequired to AsOptional/AsRequired and make Required setter internal. - Rename AddExistingEntraApplication to AddExistingEntraIdApplication. - Make disableMetrics a constructor parameter on OpenAI client builders. - Update tests, codegen snapshots, polyglot apphosts, playground, and README. Co-authored-by: Copilot App <[email protected]>
Give BicepExtensions, IBicepOutputReferenceProvider, ManagedIdentityRequiredAnnotation, and TenantScopedResourceAnnotation their own diagnostic IDs (ASPIREAZURE004-007) since ASPIREAZURE003 is for networking APIs. Co-authored-by: Copilot App <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22217Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 22217" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the Aspire 17.0 API alignment changes.
No open issues 🎉
What changed in this PR
Finalizes Aspire 17.0 API shapes following #22185, aligning hosting APIs, OpenAI client builders, and polyglot consumers before release.
Changes:
- Introduces
AsOptional()/AsRequired(), restricts theRequiredsetter, renames the existing Entra ID factory, and clarifies legacy project migration messages. - Moves
disableMetricsinto OpenAI builder constructors and assigns separate diagnostic IDs to four non-networking Azure APIs. - Updates callers, tests, generated snapshots, documentation, and examples to match.
| File | Description |
|---|---|
tests/PolyglotAppHosts/Aspire.Hosting/TypeScript/apphost.mts |
Uses renamed parameter optionality methods. |
tests/PolyglotAppHosts/Aspire.Hosting/Python/apphost.py |
Updates optionality methods and constructor options. |
tests/PolyglotAppHosts/Aspire.Hosting/Java/AppHost.java |
Uses renamed parameter optionality methods. |
tests/PolyglotAppHosts/Aspire.Hosting/Go/apphost.go |
Uses renamed parameter optionality methods. |
tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/TypeScript/apphost.mts |
Uses renamed Entra ID factory. |
tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Rust/apphost.rs |
Uses renamed Entra ID factory. |
tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Java/AppHost.java |
Uses renamed Entra ID factory. |
tests/PolyglotAppHosts/Aspire.Hosting.Azure.EntraId/Go/apphost.go |
Uses renamed Entra ID factory. |
tests/Aspire.OpenAI.Tests/OpenAIPublicApiTests.cs |
Supplies the new constructor argument. |
tests/Aspire.Hosting.Tests/ProjectResourceTests.cs |
Checks clearer deprecation messages. |
tests/Aspire.Hosting.Tests/MSBuildTests.cs |
Updates expected compiler diagnostic text. |
tests/Aspire.Hosting.Tests/ExecutionConfigurationGathererTests.cs |
Uses AsOptional() in environment coverage. |
tests/Aspire.Hosting.Tests/AddParameterTests.cs |
Updates optionality behavior tests. |
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts |
Reflects optionality APIs and deprecation messages. |
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/AtsTypeScriptCodeGeneratorTests.Generate_LegacyAddProject_RetainsDeprecatedBuilderMethod.verified.ts |
Updates generated deprecation guidance. |
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs |
Updates deprecation metadata assertions. |
tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs |
Reflects renamed parameter methods. |
tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py |
Reflects optionality methods and options. |
tests/Aspire.Hosting.CodeGeneration.Python.Tests/AtsPythonCodeGeneratorTests.cs |
Verifies updated optionality option dispatch. |
tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java |
Reflects parameterless optionality methods. |
tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go |
Reflects optionality methods; removes obsolete options. |
tests/Aspire.Hosting.Azure.Tests/TestBicepOutputReferenceProvider.cs |
Updates output-provider diagnostic suppression. |
tests/Aspire.Hosting.Azure.Tests/ProvisioningContextProviderTests.cs |
Updates tenant-scope diagnostic suppression. |
tests/Aspire.Hosting.Azure.Tests/AzureUserAssignedIdentityTests.cs |
Updates managed-identity diagnostic suppression. |
tests/Aspire.Hosting.Azure.Tests/AzureInfrastructureExtensionsTests.cs |
Updates Bicep-extension diagnostic suppression. |
tests/Aspire.Hosting.Azure.Tests/AzureEnvironmentResourceTests.cs |
Updates output-provider diagnostic suppression. |
tests/Aspire.Hosting.Azure.Tests/AzureEnvironmentResourceExtensionsTests.cs |
Updates tenant-scope diagnostic suppression. |
tests/Aspire.Hosting.Azure.EntraId.Tests/MicrosoftIdentityWebConfigurationTests.cs |
Uses renamed factory in configuration tests. |
tests/Aspire.Hosting.Azure.EntraId.Tests/LocalDeveloperCertificateTests.cs |
Updates existing-registration factory call. |
tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdResourceBuilderTests.cs |
Renames factory calls and related tests. |
tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdProvisioningTests.cs |
Updates factory, messages, and diagnostic suppressions. |
tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdPolyglotTests.cs |
Uses renamed export adapter. |
tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdKeyVaultCertificateTests.cs |
Uses renamed factory in certificate tests. |
tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdInitializationTests.cs |
Updates factory calls and expected guidance. |
tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdAppRoleAssignmentTests.cs |
Updates factory and managed-identity suppression. |
tests/Aspire.Hosting.Azure.EntraId.Tests/EntraIdApiProvisioningTests.cs |
Uses renamed factory throughout provisioning tests. |
src/Components/Aspire.OpenAI/AspireOpenAIExtensions.cs |
Passes metrics configuration through construction. |
src/Components/Aspire.OpenAI/AspireOpenAIClientBuilder.cs |
Makes metrics configuration constructor-supplied. |
src/Components/Aspire.Azure.AI.Extensions.OpenAI/AspireAzureProjectOpenAIExtensions.cs |
Passes metrics configuration to project builders. |
src/Components/Aspire.Azure.AI.Extensions.OpenAI/AspireAzureProjectOpenAIClientBuilder.cs |
Forwards the new metrics constructor argument. |
src/Components/Aspire.Azure.AI.Extensions.OpenAI/AspireAzureOpenAIExtensions.cs |
Passes metrics configuration to Azure builders. |
src/Components/Aspire.Azure.AI.Extensions.OpenAI/AspireAzureOpenAIClientBuilder.cs |
Forwards the new metrics constructor argument. |
src/Aspire.Hosting/ProjectResourceBuilderExtensions.cs |
Clarifies replacement API in deprecation messages. |
src/Aspire.Hosting/ParameterResourceBuilderExtensions.cs |
Introduces parameterless optionality methods. |
src/Aspire.Hosting/ApplicationModel/ParameterResource.cs |
Restricts setter and documents builder alternatives. |
src/Aspire.Hosting.Azure/TenantScopedResourceAnnotation.cs |
Assigns diagnostic ID ASPIREAZURE007. |
src/Aspire.Hosting.Azure/ManagedIdentityRequiredAnnotation.cs |
Assigns diagnostic ID ASPIREAZURE006. |
src/Aspire.Hosting.Azure/IBicepOutputReferenceProvider.cs |
Assigns diagnostic ID ASPIREAZURE005. |
src/Aspire.Hosting.Azure/AzureResourcePreparer.cs |
Separates experimental API diagnostic suppressions. |
src/Aspire.Hosting.Azure/AzureResourceInfrastructure.cs |
Assigns Bicep extensions ASPIREAZURE004. |
src/Aspire.Hosting.Azure/AzurePublishingContext.cs |
Updates output-provider diagnostic suppression. |
src/Aspire.Hosting.Azure/AzureProvisioningResource.cs |
Updates Bicep-extension diagnostic suppression. |
src/Aspire.Hosting.Azure/AzureProvisioningController.cs |
Updates tenant-scope diagnostic suppression. |
src/Aspire.Hosting.Azure.EntraId/README.md |
Updates factory references and examples. |
src/Aspire.Hosting.Azure.EntraId/Provisioning/EntraIdApiProvisioning.cs |
Names the replacement factory in errors. |
src/Aspire.Hosting.Azure.EntraId/EntraIdResourceExtensions.cs |
Renames factory and export; updates guidance. |
src/Aspire.Hosting.Azure.EntraId/EntraIdApplicationResource.cs |
Updates diagnostics, documentation, and error guidance. |
src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs |
Updates output-provider diagnostic suppression. |
src/Aspire.Hosting.Azure.AppContainers/BaseContainerAppContext.cs |
Updates output-provider diagnostic suppression. |
playground/EntraId/EntraId.AppHost/AppHost.cs |
Uses renamed Entra ID factory. |
Review effort: Balanced
|
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 <[email protected]>
Tests selector54 / 101 PR test projects · 4 PR jobs, from 60 changed files. Selected PR test projects (54 / 101)
Selected PR jobs (4)
How these were chosen — grouped by what changed
🔧 show 34
🔧 🧪 📦 affected project 🔧 🔧 🔧 🧪 📦 affected project 📄 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🔧 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
|
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. |
22abe75
into
release/17.0
|
✅ No documentation update needed. excluded → base_branch_is_release, title_release_prefix. The PR is prefixed |
microsoft/aspire#22217 replaced WithOptional/WithRequired(bool) with AsOptional/AsRequired. Update samples and prose, use aspire do publish-manifest, and add the new ParameterResource members to the twoslash type shims so TypeScript samples type-check. Co-authored-by: Copilot <[email protected]>
microsoft/aspire#22217 replaced WithOptional/WithRequired(bool) with AsOptional/AsRequired. Update samples and prose, use aspire do publish-manifest, and add the new ParameterResource members to the twoslash type shims so TypeScript samples type-check. Co-authored-by: Copilot <[email protected]>
## Summary Adds diagnostic pages for the four experimental IDs introduced in microsoft/aspire#22217, which moved non-networking Azure APIs off `ASPIREAZURE003`: - `ASPIREAZURE004`: `AzureResourceInfrastructure.BicepExtensions` - `ASPIREAZURE005`: `IBicepOutputReferenceProvider` - `ASPIREAZURE006`: `ManagedIdentityRequiredAnnotation` - `ASPIREAZURE007`: `TenantScopedResourceAnnotation` Each page follows the existing 17.0 diagnostic page format and covers the default compiler message, an explanation, a C# example, and suppression options. The APIs aren't exported to TypeScript AppHosts, so the pages have no TypeScript tabs. Also adds the IDs to the diagnostics overview table and the reference sidebar. ## Third-party links and affiliations None ## Validation - Measured `seoTitle` and `description` lengths manually. All fall within the 30-65 / 80-200 ranges that `tests/unit/seo-lengths.vitest.test.ts` enforces. The vitest suite wasn't run locally because dependencies aren't installed in this worktree, so CI covers it. - Checked API names and semantics against the upstream source in microsoft/aspire#22217. - Didn't compile the C# examples. Reviewers should confirm the 006 and 007 snippets. Co-authored-by: Copilot App <[email protected]>
## Summary Adds a new `aspire-entra-starter` template. It is the Aspire starter (a Blazor frontend and an ASP.NET Core API on Azure Container Apps) secured end to end with **Microsoft Entra ID**: users sign in to the frontend, and the frontend calls the API with a JWT access token. It is a templatized version of [eerhardt/aspire-entra@eerhardt/AddEntra](https://github.com/eerhardt/aspire-entra/tree/eerhardt/AddEntra). ``` aspire new --template-repository https://github.com/Azure/aspire-templates --template-path templates/aspire-entra-starter ``` ## What the template does **AppHost** (`Aspire.Hosting.Azure.EntraId`) - `apiservice-entra`: an app registration for the API that exposes an `access_as_user` scope. - `webfrontend-entra`: an app registration for the web frontend: - API permission to `access_as_user`. - Redirect URIs (`/signin-oidc`, `/signout-callback-oidc`) bound to the frontend's `https` endpoint. - `RunWithLocalDeveloperCertificateCredential()` for local dev. - `PublishWithFederatedManagedIdentityCredential()` for deployment. - Each registration is referenced by its project. Aspire injects the `AzureAd__*` and `DownstreamApis__apiservice__Scopes__*` configuration. **API** (`Microsoft.Identity.Web` 4.18) - `AddMicrosoftIdentityWebApi` JWT bearer auth, with `/weatherforecast` requiring authorization. **Web frontend** (`Microsoft.Identity.Web` 4.18) - OIDC sign-in via `AddMicrosoftIdentityWebApp`, plus token acquisition with an in-memory token cache. - The typed `HttpClient` for the API uses `AddMicrosoftIdentityMessageHandler` to attach access tokens. - `/authentication/login` and `/authentication/logout` endpoints (`MapLoginAndLogout`). - `AuthorizeRouteView` and cascading auth state. - A new `UserInfo` component in the layout shows sign-in status and sign-in/out links. - The Weather page is `[Authorize]`. It uses `BlazorAuthenticationChallengeHandler` to handle consent and step-up challenges. ## Notable differences from `aspire-azure-starter` - **Targets Aspire 17:** - `aspirecli.host.json` resolves the Aspire packages from `[17.0.0-0,18.0.0-0)`. - `Aspire.Hosting.Azure.EntraId` allows prereleases, because it has no stable 17.x release yet. Its `dotnet new` default is `17.0.0-preview.1.26567.5`; the other packages default to `17.0.0`. - New `HostingAzureEntraIdVersion` symbol. - **No `Aspire.AppHost.Sdk`:** it is obsolete in 17.0 (ASPIRE012). The AppHost uses `Microsoft.NET.Sdk` with explicit package references and calls `AddDotnetProject`. - **Removed:** - The Redis cache option, and output caching, since the only cached page now requires sign-in. - The test project option. - `NoHttps` / `HasHttpsProfile`, because Entra redirect URIs require the `https` endpoint. - `LICENSE` and `nuget.config` from the template output. - **`.slnx`** solution instead of `.sln`. - New identity, groupIdentity and GUIDs, and an `Identity` classification. All 14 localization files are updated. - Root `README.md` lists the new template and adds a prerequisites section: Azure subscription and Entra permissions, `az login`, the dashboard's Azure prompts, tenant-scoped registrations with `Azure:TenantResourceSuffix`, and the https requirement. ## Notes / caveats - App registrations are provisioned **even in run mode**, so running the AppHost requires an Azure subscription and permission to create Entra app registrations. - The `Aspire.Hosting.Azure.EntraId` API is still preview and may change (microsoft/aspire#22217). ## Validation - `dotnet new` with nuget.org only: the `net10.0` and `net11.0` variants built with 0 errors. - `aspire new --template-path` with Aspire CLI 17.0.0: resolved `17.0.0` for the Aspire packages and `17.0.0-preview.1.26567.5` for EntraId, and the AppHost built. --------- Co-authored-by: Copilot App <[email protected]>
Description
Addresses API review feedback on the 17.0 API surface from #22185, so the new APIs ship with their final shape in 17.0.
Changes:
Legacy
AddProjectoverloads (r4552196643): the[Obsolete]messages are clearer and point users to the replacement API.Parameter optionality (r4552196666):
WithOptional/WithRequiredare replaced with parameterlessAsOptional()/AsRequired()methods.ParameterResource.Requiredsetter is now internal.Entra ID (r4552196738):
AddExistingEntraApplicationis renamed toAddExistingEntraIdApplication.OpenAI client builders (r4552196760): the OpenAI and Azure OpenAI client builders take
disableMetricsas a constructor parameter.Diagnostic IDs (r4552196701):
ASPIREAZURE003is meant for networking APIs. Four non-networking experimental Azure APIs that used it now have their own IDs:AzureResourceInfrastructure.BicepExtensionsusesASPIREAZURE004.IBicepOutputReferenceProviderusesASPIREAZURE005.ManagedIdentityRequiredAnnotationusesASPIREAZURE006.TenantScopedResourceAnnotationusesASPIREAZURE007.Pages for the new IDs still need to be added to aspire.dev.
Callers, tests, snapshots, READMEs, the playground and the polyglot apphosts are updated to match. The generated API files are not edited.
Not addressed:
string?without a default) #22211.WithReplfeedback (r4552196716) is left unchanged.Validation
These targeted test runs passed (
dotnet test --project <proj> --no-launch-profile -- --filter-class ... --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"):Aspire.Hosting.Azure.Tests: the affected classes passed 237/237.Aspire.Hosting.Azure.EntraId.Tests: 694/694 passed.These were not validated locally:
MSBuildTests: some fail locally and were skipped.javacis unavailable locally, so they were not compiled.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?