Skip to content

Project Radius backing resource connections from recipe outputs, and upgrade to Radius 0.60 - #19253

Closed
Nell Shamrell-Harrington (nellshamrell) wants to merge 19 commits into
mainfrom
fix-radius-backing-resources
Closed

Nell Shamrell-Harrington (nellshamrell) wants to merge 19 commits into
mainfrom
fix-radius-backing-resources

Conversation

@nellshamrell

@nellshamrell Nell Shamrell-Harrington (nellshamrell) commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #19031, which was opened from a fork branch. This PR continues the same work from a branch pushed directly to microsoft/aspire, and has since picked up further review feedback and a rebase onto main.

Description

An Aspire app deployed to Radius could not talk to its own cache, database, or queue. Every connection value the app received was wrong, so WithReference produced a connection string that pointed nowhere and the app failed at startup.

The cause is that a "backing" resource targeted at a Radius environment — Redis, PostgreSQL, MongoDB, SQL Server, RabbitMQ — is not deployed as a Radius.Compute/containers workload. It is provisioned by a Radius recipe. The recipe, not Aspire, decides the Kubernetes Service name and generates the credentials. Aspire was still deriving the host, port, and password from its own endpoint model, so it emitted a container-shaped address like cache-cache.default.svc.cluster.local for a Service the recipe had named something else, paired with a password the recipe never issued.

Scope

This started as the connection-projection fix above and grew, in review, into four related changes. They are together because each one is required for the first to actually work end to end — a projected connection value is only correct if it names the right recipe, survives the deploy, and does not leak on the way:

# Change Why it is here
1 Project backing-resource connections from recipe outputs The original bug (#18935).
2 Pin Radius to 0.60 and migrate Redis / RabbitMQ to their Radius.* UDTs 0.60 renames the recipePacks fields the publisher writes. The API server drops unknown fields instead of rejecting them, so the pre-0.60 spelling publishes and deploys cleanly while producing an empty recipe pack — every backing resource then fails to resolve a recipe. Correct projection onto a silently-empty pack is still a broken deployment.
3 Publish credential-bearing container env vars as valueFrom.secretKeyRef Projection is what puts recipe credentials into consumer environment variables. Emitting them inline would have written those newly-correct credentials into the Deployment spec and its rollout history in clear text — this PR creates the exposure, so it closes it.
4 Turn silent misconfiguration into publish-time diagnostics (ASPIRERADIUS069–086) Every case where the publisher cannot project a truthful value now fails or warns by name, instead of emitting a document that deploys and then misbehaves. This is the same class of bug as #18935, found while fixing it.

Items 2 and 3 landed together in a single commit (a3a8ffbb0), because the secret carrier they both depend on — Radius.Security/secrets — is introduced by 0.60; reviewing that commit on its own covers both.

User-facing behavior

Referencing a backing resource now works. Every value a consumer sees is projected from that resource's own Radius outputs:

Value Projected from
Host / port, and anything composed from them (ConnectionStrings__*, *_HOST, *_PORT, *_URI, service discovery) <resource>.properties.host / <resource>.properties.port
Password, for resources emitted as legacy Applications.* types (MongoDB, SQL Server) <resource>.listSecrets().password
User name, for those same types <resource>.properties.username
Password and user name, for resources emitted as Radius.* types (PostgreSQL, RabbitMQ) Passed into the recipe on the resource type's required username / password schema properties, using the same secure Bicep parameter Aspire composes into the connection string, so both sides agree by construction. RabbitMQ takes its password as the resource ID of a Radius.Security/secrets resource rather than as a string
Password, for Redis Nothing — the mapped recipe deploys an unauthenticated server. A password Aspire generated is dropped with ASPIRERADIUS075; one supplied explicitly fails the publish with ASPIRERADIUS085

Because the substitution happens on the underlying values rather than on formatted strings, connection strings, URIs, and the individual properties emitted by WithReference all resolve consistently.

Failures that were previously silent are now reported by name. The full set is ASPIRERADIUS069–086, tabulated in src/Aspire.Hosting.Radius/README.md; the ones most likely to change the outcome for an existing AppHost:

  • Referencing a backing resource in a different Radius environment fails with ASPIRERADIUS069 instead of emitting an unroutable address. This also surfaces from the Kubernetes, Azure Container Apps, and Azure App Service publishers, which resolve such references through the owning Radius environment.
  • A value that cannot be resolved at publish time — most commonly an Azure Bicep output — is logged at Warning. It was previously dropped at Debug, so every environment variable sourced from an Azure resource referenced by a Radius container silently disappeared from the published output.
  • A credential parameter the AppHost author supplied is reported when the recipe's generated credential replaces it, since the author's value never reaches the cluster.
  • A TLS-enabled backing endpoint asked for Scheme, TlsEnabled, or Url fails with ASPIRERADIUS081. No mapped Radius type publishes a transport-security output, so those values would describe how the resource runs locally (rediss://, ssl=true) against a server the recipe starts in plaintext.
  • A password supplied explicitly to Redis fails with ASPIRERADIUS085 rather than being dropped: the recipe deploys an unauthenticated server, and quietly downgrading an author's request for authentication is not a decision the publisher should make. A password Aspire generated is still dropped, with the ASPIRERADIUS075 warning.
  • AddRabbitMQ(...) without an explicit user name fails with ASPIRERADIUS082 (see the 0.60 section below).
  • A referenced AddSqlServer("sql").AddDatabase("appdb") warns with ASPIRERADIUS080: the legacy SQL recipe echoes the database parameter into its outputs but never runs CREATE DATABASE, so the consumer was being handed a connection string naming a catalog the deployment does not contain.

Radius 0.60 is now the minimum supported runtime

This is a breaking change for anyone deploying to Radius v0.59 or earlier, and the incompatibility is silent. v0.60 renamed the Radius.Core/recipePacks fields recipeKind/recipeLocation to kind/source. The Radius API server ignores fields it does not recognize rather than rejecting them, so deploying these artifacts to a v0.59 cluster produces an empty recipe pack with no publish error and no deploy error — and every backing resource then fails to resolve a recipe. There is no version negotiation available to soften this, so the package pins 0.60 and the README states the requirement up front.

What the upgrade brings with it:

  • Redis and RabbitMQ move onto their Radius.* UDTs (Radius.Data/redisCaches, Radius.Messaging/rabbitMQ — note: not rabbitMQQueues) and their legacy Applications.* fallbacks are gone. MongoDB, SQL Server, and the Dapr building blocks stay on the legacy types, because their UDT equivalents still have no published Kubernetes recipe.
  • Radius.Security/secrets is the new carrier for credentials a UDT consumes by resource ID. RabbitMQ's password property takes the resource ID of a secrets resource, not a password string.
  • RabbitMQ requires an explicit user name (ASPIRERADIUS082). The 0.60 schema restricts guest to loopback connections, so a broker provisioned with the Aspire default would reject every workload pod — and the default arrives at the publisher as literal text inside the connection string, with no value to rewrite, so the broker and the connection string cannot be made to agree.
  • The Redis and RabbitMQ recipes are pinned by commit SHA, not :latest. resource-types-contrib moves :latest only on a stable recipe release and publishes an immutable <sha> tag on every push to main — the tag its own workflow documents as "the tag Radius pins against". Both recipes post-date the last stable release, so :latest does not exist for either, and referencing it fails at deploy time with RecipeDownloadFailed. edge is not usable either: it floats, and a generated artifact must keep deploying the recipe it was published against.

Credentials reach containers as secret references

Container environment variables were previously always emitted as env: { NAME: { value: ... } }. Routing a credential through an @secure() Bicep parameter keeps it out of the published artifact, but the resolved string still lands in the Kubernetes Deployment spec — readable by anyone with get deployment in the namespace, and retained in the rollout history after a rotation.

A value that carries a credential is now written to a Radius.Security/secrets resource named <container>-env-secret and referenced by key:

PGDB_USERNAME: {
  value: 'postgres'
}
PGDB_PASSWORD: {
  valueFrom: {
    secretKeyRef: {
      secretName: 'api-env-secret'
      key: 'PGDB_PASSWORD'
    }
  }
}

A value counts as credential-bearing if it is built from a secret parameter (AddParameter(name, secret: true), and the passwords Aspire generates for backing resources) or from a recipe's listSecrets() output. Everything else keeps its plain value, so the deployed spec stays readable. Because the variable name becomes a Kubernetes Secret data key, it is validated at publish time against the full API-server contract — 1–253 characters of [-._a-zA-Z0-9], and not ., .., or ..-prefixed — instead of failing when the Secret reaches the cluster (ASPIRERADIUS083).

User-facing usage

No API change is required — this is what an existing AppHost already looks like, and it now deploys correctly:

var builder = DistributedApplication.CreateBuilder(args);

var radius = builder.AddRadiusEnvironment("prod");

var cache = builder.AddRedis("cache");
var db = builder.AddPostgres("pg").AddDatabase("appdb");

builder.AddProject<Projects.Api>("api")
       .WithReference(cache)
       .WithReference(db);

builder.Build().Run();

aspire publish now emits, for the container:

ConnectionStrings__cache: {
  value: '${cache.properties.host}:${cache.properties.port},password=${cache.listSecrets().password}'
}
ConnectionStrings__appdb: {
  value: 'Host=${pg.properties.host};Port=${pg.properties.port};Username=postgres;Password=${pg_password};Database=appdb'
}

pg_password is the secure parameter Aspire also passes into the recipe, so the value the app receives and the value the recipe provisions are the same by construction. Where the same credential appears inside a URI it is escaped:

PG_URI: {
  value: 'postgresql://postgres:${uriComponent(pg_password)}@${pg.properties.host}:${pg.properties.port}/appdb'
}

The one new public API is the exception, so that a cross-environment reference can be caught by name:

try
{
    await app.RunAsync();
}
catch (RadiusBackingResourceEndpointException ex)
{
    Console.Error.WriteLine($"'{ex.Resource.Name}' is provisioned by a Radius recipe in " +
                            "another environment, so its address cannot be resolved here.");
}

Implementation notes

  • RadiusBackingConnections holds the type → connection-schema table. Its credential mode is a closed hierarchy (ListSecrets / RecipeInputProperties / NotProjected) so "credential handled by neither mechanism" — the exact shape of this bug — is unrepresentable, and a contract test fails if a newly mapped backing type has no schema entry.
  • The container environment-variable loop previously caught InvalidOperationException broadly. That was positional rather than structural; it is now narrowed to the conditions the publisher genuinely intends to skip, raised as an internal RadiusUnresolvableValueException. A value is only skipped when it is an IManifestExpressionProvider (a positive marker for "produced by another deployment") and it fails to resolve; an InvalidOperationException from any other value provider now fails the publish rather than silently dropping the variable.
  • Credentials for Radius.* types are written to the resource type's top-level schema properties rather than properties.recipe.parameters. The manifests in radius-project/resource-types-contrib declare username / password as required properties and the recipes read them as context.resource.properties.<name>, so the recipe-parameter shape would have failed schema validation at deploy time.
  • The default recipe for Radius.Data/postgreSqlDatabases is ghcr.io/radius-project/kube-recipes/postgresqldatabases:latest. The recipes/local-dev/postgresqldatabases artifact this originally pointed at is not published.
  • Values a ReferenceExpression marked as URI components are emitted as Bicep uriComponent(...), so a recipe-generated password containing @ or / cannot corrupt the URI it sits in.
  • The multi-database failure is scoped to databases consumers actually reference; unreferenced extras and servers with no database child warn and continue. Declaring several databases and referencing none of them fails too, rather than defaulting to the first: a database consumed only from inside a WithEnvironment callback records no reference annotation, so the choice cannot be proven.
  • SQL Server is emitted as the legacy Applications.Datastores/sqlDatabases type. The contrib UDT is Radius.Data/sqlServerDatabases (not sqlDatabases), and its Kubernetes recipe is not published — there is no ghcr.io/radius-project/kube-recipes/sqlserverdatabases repository at all — so the legacy type, which has both a published recipe and a listSecrets() action, is the only deployable option today.
  • A credential parameter cannot serve two roles: using one parameter as both the user name and the password of a resource, or sharing it across resources when either credential is recipe-generated, fails with ASPIRERADIUS070. Substitutions are keyed by parameter identity, so such a parameter could only ever be rewritten to one of the two values.
  • New diagnostic codes ASPIRERADIUS069–086, documented in src/Aspire.Hosting.Radius/README.md along with the known gaps (the default MongoDB user name cannot be projected, Radius.Messaging/rabbitMQ carries a queue property Aspire has no concept of, uriComponent escaping differs cosmetically from Uri.EscapeDataString, and only a resource's primary endpoint is projectable).
  • ASPIRERADIUS076 fails the publish when the recipe's input schema does not accept the credential properties the resource requires, which previously produced a resource nothing could authenticate against.
  • The ASPIRERADIUS081 TLS guard is enforced in RadiusEnvironmentResource rather than only in the publisher, so a Kubernetes, Azure Container Apps, or App Service consumer that resolves a Radius-owned endpoint through ComputeEnvironmentEndpointResolver gets the same failure instead of a locally-derived rediss/TlsEnabled=True. Host/Port/HostAndPort still project — the address is right regardless of transport.
  • The ASPIRERADIUS070 "unrelated use of a substituted parameter" check now takes provenance from the connection-property injection (the variable name the splat produces for a declared reference, with an aliased connectionName recovered from the ConnectionStrings__<name> entry the same call emits) rather than from value equality. A user-authored value identical to an injected property is still silently replaced by the recipe credential, so it is now reported instead of exempted.

Validation

  • Aspire.Hosting.Radius.Tests: 546 passing, 0 failing (the count includes the secret-store tests that landed on main while this branch was open). The new tests cover schema totality, the cross-publisher exception contract, the narrowed-catch conditions (both the skip and the fail-the-publish path), user-name projection, database scoping, the credential warnings, and URI escaping.
  • A deployment end-to-end test, DeployRadiusPostgresBackingResourceToKind, stands up KinD plus the Radius control plane, publishes an AppHost that references a Postgres backing resource, deploys the generated artifacts, and then reads the environment back off the deployed container and authenticates against the provisioned database with psql. This is what surfaced the property-shape and recipe-source bugs above, which the Bicep snapshots could not catch.
    • This originally needed the test to register the type by hand (rad resource-type create plus rad bicep publish-extension) and to patch the published artifact, because Radius.Data/postgreSqlDatabases was absent from the Bicep extension at 0.59. Radius 0.60 ships the type in the pinned extension and registers it at rad install kubernetes, so all of that is gone: the test publishes and then runs aspire deploy against the untouched artifacts, which is the path a user actually follows.
  • A second deployment end-to-end test, DeployRadiusRedisAndRabbitMqBackingResourcesToKind, covers the two types whose 0.60 migration cannot be proven from a Bicep snapshot. RabbitMQ's password takes the resource ID of a Radius.Security/secrets resource, so only a real deployment shows that Radius dereferenced it and the broker enforces the projected credential. It also asserts the credential reaches the pod as a secretKeyRef and that the plaintext appears nowhere in the Deployment spec.
  • No behavior change in the publishers that share the endpoint resolver: Aspire.Hosting.Kubernetes.Tests 269/269, Aspire.Hosting.Azure.Kubernetes.Tests 63/63, Aspire.Hosting.Azure.Tests 1645 passed / 5 skipped.
  • ./build.sh clean with 0 warnings.
  • Every added or changed Verify snapshot was reviewed line by line rather than accepted on a green test, since this repo enables AutoVerify locally.

Security considerations

This change alters how credentials appear in generated deployment artifacts, so it is flagged for review even though the net effect is a reduction in exposure:

  • Aspire-generated password parameters for backing resources are no longer emitted into the published Bicep. Previously they were written as secure parameters that the recipe ignored, so the artifact carried credential material that had no deployment purpose.
  • Passwords are now read at deploy time via listSecrets(), or passed into the recipe as a secure parameter. No secret value is materialized into the generated file in either case.
  • Values interpolated into URIs are wrapped in uriComponent(...). Recipe-generated passwords come from an alphabet the recipe chooses rather than Aspire's URL-safe generator, so an unescaped @, /, or : could previously have re-parsed the URI's authority section.
  • Where the credential ends up is a trade, not a strict win, and reviewers should weigh it. listSecrets() is evaluated by the deployment engine, so the resolved secret is written into the consuming resource's Deployment spec (and is therefore readable by anything with get pod/get deployment in the namespace, and by anyone who can read the deployment history that records the evaluated template output). The alternative - declaring the value @secure() - keeps it out of deployment history but requires the operator to supply it out of band, which defeats the point of a recipe that generates its own credential. The correct long-term shape is a secret reference so neither the artifact nor the Deployment spec carries the plaintext, and this PR now lands it: a container environment variable that carries a credential is published as valueFrom.secretKeyRef against a Radius.Security/secrets resource named <container>-env-secret, rather than as an inline value. Non-credential variables keep their plain value, so the deployed spec stays readable. Net: both the artifact-at-rest and the Deployment-spec exposure are reduced.
  • Redis is a special case worth naming: its recipe deploys an unauthenticated server and emits no secrets output at all, so no credential is projected. The generated connection string carries an empty password. A password Aspire generated is dropped with the ASPIRERADIUS075 warning; a password the AppHost author supplied fails the publish with ASPIRERADIUS085, because silently downgrading an explicit request for authentication is a security decision the publisher should not make. This is the recipe's security posture, not a change introduced here - see the Known limitations section of the README.

Fixes #18935

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

Copilot AI balanced review requested due to automatic review settings August 11, 2026 22:32
@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 -- 19253

Or

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

@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Aug 11, 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

Fixes Radius backing-resource connections by projecting recipe-provided endpoints and credentials into consumer environments.

Changes:

  • Adds recipe-output connection projection and credential handling.
  • Adds cross-environment diagnostics and URI escaping.
  • Expands unit, snapshot, and deployment coverage.

Reviewed changes

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

Show a summary per file
File Description
tests/Aspire.Hosting.Radius.Tests/Snapshots/LegacyFallbackEmissionTests.UdtOnly_DoesNotEmitLegacyParents.verified.bicep Updates PostgreSQL UDT output.
tests/Aspire.Hosting.Radius.Tests/Snapshots/LegacyFallbackEmissionTests.MixedLegacyAndUdt_EmitsBothParentPairs.verified.bicep Updates mixed-resource output.
tests/Aspire.Hosting.Radius.Tests/Snapshots/LegacyFallbackEmissionTests.LegacyAndUdt_ShareResourceNameAndUseDistinctParents.verified.bicep Updates shared-name output.
tests/Aspire.Hosting.Radius.Tests/Snapshots/BackingResourceValueResolutionTests.UserNameParameter_IsProjectedFromRecipeOutputs.verified.bicep Covers username projection.
tests/Aspire.Hosting.Radius.Tests/Snapshots/BackingResourceProjectionTests.LegacyBackingResource_DoesNotLeakAspireGeneratedPasswordParameter.verified.bicep Verifies password secrecy.
tests/Aspire.Hosting.Radius.Tests/Snapshots/BackingResourceProjectionTests.DirectEndpointPropertyReference_ProjectsRecipeOutputs.verified.bicep Covers direct endpoint properties.
tests/Aspire.Hosting.Radius.Tests/Snapshots/BackingResourceProjectionTests.CallbackRenamingBackingResource_RewiresProjectedEnvironmentValues.verified.bicep Covers callback renaming.
tests/Aspire.Hosting.Radius.Tests/Snapshots/BackingResourceProjectionTests.AllBackingResourceTypes_ProjectRecipeOutputs.verified.bicep Covers all backing types.
tests/Aspire.Hosting.Radius.Tests/ResourceMapping/ResourceTypeMapperTests.cs Updates SQL Server mapping tests.
tests/Aspire.Hosting.Radius.Tests/RecordingLogger.cs Adds diagnostic capture helper.
tests/Aspire.Hosting.Radius.Tests/Publishing/BicepGenerationMultiResourceTests.cs Updates SQL Server assertion.
tests/Aspire.Hosting.Radius.Tests/Publishing/BackingResourceValueResolutionTests.cs Tests value and credential resolution.
tests/Aspire.Hosting.Radius.Tests/Publishing/BackingResourceProjectionTests.cs Tests recipe-output projection.
tests/Aspire.Hosting.Radius.Tests/Publishing/BackingResourceContractTests.cs Tests mapping/schema contracts.
tests/Aspire.Cli.EndToEnd.Tests/RadiusDeployTests.cs Adds PostgreSQL deployment validation.
src/Aspire.Hosting.Radius/ResourceMapping/ResourceTypeMapper.cs Maps SQL Server to legacy Radius type.
src/Aspire.Hosting.Radius/ResourceMapping/RadiusResourceTypes.cs Corrects SQL Server type constants.
src/Aspire.Hosting.Radius/README.md Documents projections and diagnostics.
src/Aspire.Hosting.Radius/RadiusEnvironmentResource.cs Rejects underivable backing endpoints.
src/Aspire.Hosting.Radius/RadiusBackingResourceEndpointException.cs Adds public endpoint exception.
src/Aspire.Hosting.Radius/Publishing/RadiusUnresolvableValueException.cs Narrows skippable resolution failures.
src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs Implements connection projection logic.
src/Aspire.Hosting.Radius/Publishing/RadiusBackingConnections.cs Defines backing-resource schemas.
src/Aspire.Hosting.Radius/Publishing/Constructs/RadiusResourceTypeConstruct.cs Adds UDT credential properties.

Comment thread src/Aspire.Hosting.Radius/README.md Resolved
@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 24 out of 24 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs:1462

  • This structural match also classifies a separately authored expression as an injected connection property. For example, WithEnvironment("ADMIN_PASSWORD", ReferenceExpression.Create($"{shared}")) has the same ValueExpression as the backing resource's Password property, so shared is replaced by the recipe secret but ResolveParameterPart receives the credential owner and suppresses the promised ASPIRERADIUS070 warning. Track provenance for the actual splatted values rather than inferring ownership solely from expression text.
            foreach (var (_, connectionProperty) in withConnectionString.GetConnectionProperties())
            {
                if (string.Equals(connectionProperty.ValueExpression, valueExpression, StringComparison.Ordinal))
                {
                    return credentialOwner;

src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs:2045

  • A database child is not the registered credential owner; its parent server is. Here the child connection string is resolved with the child as provenance, and child-specific splatted expressions also fail the parent-only structural match above. For MongoDBDatabaseResource, both paths expand the parent's password directly, so a normal WithReference(database) is misreported as an unrelated credential use under ASPIRERADIUS070. Normalize child provenance to the parent and recognize connection properties originating from its database children.
                // The credential parameters inside a backing resource's own connection string are
                // exactly the ones the substitution is meant to rewrite, so the referenced resource
                // becomes the context here — otherwise every consumer of `.WithReference(cache)`
                // would be reported as an unrelated use of the cache's own password.
                await ResolveEnvPartsAsync(connectionStringReference.Resource.ConnectionStringExpression, owner, parts, connectionStringReference.Resource, allowRecipeSubstitutions).ConfigureAwait(false);

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 24 out of 24 changed files in this pull request and generated 1 comment.

Suppressed comments (3)

src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs:1463

  • Matching only ValueExpression conflates value equality with provenance. An unrelated environment value such as ReferenceExpression.Create($"{shared}") has the same expression as a backing resource's password connection property, so this returns the credential owner and suppresses the ASPIRERADIUS070 warning even though shared is then replaced with that resource's recipe secret. Track which values were injected by WithReference instead of treating every structurally identical expression as originating from the backing resource.
            foreach (var (_, connectionProperty) in withConnectionString.GetConnectionProperties())
            {
                if (string.Equals(connectionProperty.ValueExpression, valueExpression, StringComparison.Ordinal))
                {
                    return credentialOwner;
                }

tests/Aspire.Cli.EndToEnd.Tests/RadiusDeployTests.cs:254

  • This test installs KinD and the Radius control plane, pulls network artifacts, and allows a 20-minute deployment, so running it as a normal [Fact] puts a resource-intensive outer-loop scenario in the regular test suite. Mark it with OuterloopTest, as other network/container installation tests in this project do (for example PodmanDeploymentTests.cs:21).
    [Fact]
    [CaptureWorkspaceOnFailure]

src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs:2069

  • IManifestExpressionProvider is not a reliable marker for “only known after another deployment.” For example, StaticValueProvider<T> and ContainerImageReference also implement it and can throw InvalidOperationException for genuine invalid state. Those failures still reach this filter, are misreported as deferred deployment values, and cause the environment variable to be omitted instead of failing publication. Gate this on an explicit deferred-deployment contract rather than the general manifest-expression interface.
                    catch (InvalidOperationException ex) when (value is IManifestExpressionProvider manifestExpressionProvider)
                    {

Comment on lines +66 to +69
RadiusResourceTypes.SqlServerDatabases,
RadiusResourceTypes.RadiusApiVersion,
RadiusResourceTypes.LegacySqlDatabases,
RadiusResourceTypes.LegacyApiVersion),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right that the database is not created. I dug into the recipe: Applications.Datastores/sqlDatabases takes a database parameter and only echoes it back into its outputs — the workload it deploys is a SQL Server container with the sa login and nothing that runs CREATE DATABASE. So a referenced AddSqlServer("sql").AddDatabase("appdb") was handing the consumer a connection string naming a database the deployment does not contain, silently.

Publishing now warns (0831627), scoped to referenced database children so an inert AddDatabase(...) stays quiet, matching the ASPIRERADIUS072 precedent. Also documented as a known limitation.

I chose warn over fail for three reasons, and I am open to being overruled on any of them:

  1. The publisher cannot fix it. There is no database input the recipe would honour and no post-deploy hook to run DDL.
  2. Remapping to a type that could create it is not available. Radius.Data/sqlServerDatabases exists in resource-types-contrib, but ghcr.io/radius-project/kube-recipes/sqlserverdatabases returns 403 — no published Kubernetes recipe, unlike postgresqldatabases which has one. So the SQL equivalent of the Postgres path does not exist yet.
  3. Failing would break models that work today. An app using EF Core Migrate()/EnsureCreated(), or sa connecting to master, deploys fine against this recipe. Turning that into a publish error is a regression for them with no workaround short of removing AddDatabase.

If you would rather this be hard-fail I will make it one — it is a small change (the warning site is already scoped correctly) but it needs an escape hatch, and I did not want to add public API speculatively.

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.

Three correctness issues should be addressed before merge: the generated PostgreSQL artifacts cannot use the standard Aspire deploy path, unresolved non-HTTP endpoint values can now abort publishing, and metadata-only backing endpoint properties regress across compute environments. I also left one documentation correction for RabbitMQ. The existing open PostgreSQL database-default and SQL Server child-database threads remain applicable.

Comment thread src/Aspire.Hosting.Radius/README.md Resolved
await ResolveEnvPartsAsync(rawValue, resource, parts, ResolveEnvValueProvenance(rawValue, resource)).ConfigureAwait(false);
}
catch (InvalidOperationException ex)
catch (RadiusUnresolvableValueException ex)

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.

This narrowing regresses the unavailable-endpoint case the old catch explicitly handled. For a non-backing container with an unallocated non-HTTP endpoint, ResolveEndpointUrl reaches GetDefaultPort, which throws a plain InvalidOperationException; that now aborts the entire publish instead of omitting the unresolved environment variable. Wrap the known endpoint-resolution failure in RadiusUnresolvableValueException at ResolveEndpointUrl / ResolveEndpointProperty so genuine errors still propagate while this supported publish-time omission remains intact, and add a regression test for an unallocated tcp endpoint.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I went looking for the test and could not make the throw fire, so I traced it instead — I think the branch is unreachable, and I would rather say so than add a test that passes for the wrong reason.

ResolveServicePort runs before GetDefaultPort and delegates to ResourceExtensions.ResolveEndpoints, whose fallback arm is _ => ResolvedPort.Allocated(portAllocator.AllocatePort()) (ResourceExtensions.cs:857). An endpoint with no port declared still resolves to an allocated one, so a portless non-HTTP endpoint never reaches GetDefaultPort. The single case where ResolveServicePort returns null is a projects synthetic default HTTPS endpoint (RadiusServiceDiscovery.cs:118-124), and httpsis one of the schemesGetDefaultPort` answers (443).

I added the regression test anyway, since the reachability argument is only as good as the call graph today: PortlessNonHttpEndpoint_IsResolvedRatherThanOmitted builds a portless tcp endpoint and asserts it emits an allocated port rather than throwing. It passes. If you would still rather the throw not exist at all I am happy to replace it with a Debug.Assert, but I did not want to change behaviour on an unreachable path without your call.

@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 24 out of 24 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs:2052

  • Resolve credential ownership through the emitted parent here. For a legacy database child such as AddSqlServer(...).AddDatabase(...), the recipe credential is registered to the server, but this passes the child as referencedResource; ResolveParameterPart therefore emits an ASPIRERADIUS070 “unrelated use” warning for the child's legitimate connection string. Classifying the child by its parent avoids the false warning.
        bool IsNumeric)

src/Aspire.Hosting.Radius/RadiusBackingResourceEndpointException.cs:58

  • This public constructor throws ArgumentNullException when resource is null, but the XML documentation omits that exception. Public API exception behavior should be documented for IntelliSense.
    /// <param name="resource">The backing resource whose address could not be determined.</param>
    /// <param name="message">The message that describes the error.</param>
    public RadiusBackingResourceEndpointException(IResource resource, string message)

switch (schema.Credentials)
{
case RadiusBackingConnections.RadiusCredentialMode.ListSecrets(var passwordSecret):
ApplyListSecretsCredentials(resource, withConnectionString, construct, schema, passwordSecret);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the same concern as the earlier thread on the SQL Server → legacy recipe mapping, where I have left a detailed reply. Keeping the discussion in one place rather than answering twice — please follow it there. Leaving this thread open until that one is settled, since the resolution will be the same for both.

@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 24 out of 24 changed files in this pull request and generated no new comments.

Suppressed comments (2)

src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs:2204

  • A conditional expression whose condition is a deployment-time value still fails the entire publish here. For example, a BicepOutputReference used as Condition throws InvalidOperationException before its deployment has run, but this call bypasses the IManifestExpressionProvider conversion in ResolveEnvPartsAsync, so the environment-variable loop never receives RadiusUnresolvableValueException and cannot omit the variable with the documented warning. Resolve conditions through an equivalent marker-gated path while preserving the rule that unrelated nested InvalidOperationExceptions must still fail publication.
            var conditionContext = new ValueProviderContext { ExecutionContext = _executionContext, Caller = owner };
            var conditionValue = await expression.Condition!.GetValueAsync(conditionContext, _cancellationToken).ConfigureAwait(false);

src/Aspire.Hosting.Radius/RadiusBackingResourceEndpointException.cs:58

  • The new public constructor throws when resource is null, but its XML documentation omits that exception. Documenting thrown exceptions is required for public APIs so IntelliSense accurately describes the contract.
    /// <param name="resource">The backing resource whose address could not be determined.</param>
    /// <param name="message">The message that describes the error.</param>
    public RadiusBackingResourceEndpointException(IResource resource, string message)

@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 24 out of 24 changed files in this pull request and generated no new comments.

Suppressed comments (2)

src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs:1548

  • This structural match can suppress the new ASPIRERADIUS070 warning for an unrelated use. For example, WithEnvironment("ADMIN_PASSWORD", ReferenceExpression.Create($"{shared}")) has the same ValueExpression as the backing resource's Password connection property, so this method attributes it to the backing resource and the consumer silently receives the recipe secret without the promised warning. Equality of values does not establish provenance; preserve explicit injection metadata or otherwise distinguish connection-property injection from an independently authored expression.
            foreach (var (_, connectionProperty) in withConnectionString.GetConnectionProperties())
            {
                if (string.Equals(connectionProperty.ValueExpression, valueExpression, StringComparison.Ordinal))
                {
                    return credentialOwner;

tests/Aspire.Hosting.Radius.Tests/Publishing/BackingResourceContractTests.cs:190

  • This helper intentionally leaves both the test builder and the built DistributedApplication undisposed for every theory invocation. Building initializes a service provider that owns disposable services; the returned resource objects do not require that provider to remain alive. Dispose both objects after materializing the endpoint annotations to avoid accumulating test resources.
        // Build so endpoint annotations are materialized; the builder is intentionally not disposed
        // here because the returned resources outlive it and hold no disposable state.
        _ = builder.Build().Services.GetRequiredService<DistributedApplicationModel>();

Fixes the findings from the code-review, hosting-integration-authoring and
architecture reviews of the backing-resource projection change.

Error handling. The env-var loop's `catch (InvalidOperationException)` was
positional rather than structural: it silently dropped every value produced
by an Azure Bicep output, at Debug level, because that is the type
`BicepOutputReference.Value` happens to throw. The two conditions the
publisher genuinely means to skip -- a value only knowable after another
deployment, and a reference to an endpoint the target does not declare --
are now raised as `RadiusUnresolvableValueException` and logged at Warning;
everything else fails the publish.

Exception contract. `RadiusBackingResourceEndpointException` is now public
and lives in `Aspire.Hosting.Radius`, because it reaches authors using the
Kubernetes, Container Apps and App Service publishers through the shared
endpoint resolver. Its message is written for that audience.

Schema table. The `(string? PasswordSecret, bool TakesCredentialRecipeParameters)`
pair could express "credential handled by neither mechanism" -- the shape of
the bug this change fixes -- so it is replaced by a closed credential mode.
Radius types with no verified schema are removed rather than left to project
values that may not exist, and a test fails if an emitted type has no entry.

Credentials. A user name supplied as a parameter is now projected from the
recipe's output like the password already was, so the connection string no
longer names a user the recipe never created. Replacing a credential the
AppHost author chose is reported, since its value never reaches the cluster.

Databases. The multi-database failure is scoped to databases consumers
actually reference; a server with no database child publishes with a warning.
Recipe inputs are resolved through a substitution-free path so a recipe
cannot be fed its own output, and are rebuilt when a
`ConfigureRadiusInfrastructure` callback swaps the construct they target.

URI escaping. Values a reference expression marked as URI components are
emitted as `uriComponent(...)`, so a recipe-generated password containing
`@` or `/` cannot corrupt the URI it is placed in.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: b3bee2e4-d5fd-4325-a4e7-090e4598c5e1
The exception is the one piece of public API this change introduces, and
catching it is the whole reason it is public, so show that.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: b3bee2e4-d5fd-4325-a4e7-090e4598c5e1
Address the second round of review feedback on the Radius backing
resource projection:

- Credentials for Radius.* resource types are now written to the
  required top-level schema properties (username/password/database)
  instead of properties.recipe.parameters. The resource type manifests
  in radius-project/resource-types-contrib declare these as required
  properties and the recipes read them via
  context.resource.properties.<name>, so the previous shape would have
  failed schema validation at deploy time.
- Point Radius.Data/postgreSqlDatabases at
  ghcr.io/radius-project/kube-recipes/postgresqldatabases:latest. The
  recipes/local-dev/postgresqldatabases artifact is not published.
- Only skip an environment variable when the failing value provider is
  an IManifestExpressionProvider, so an InvalidOperationException from
  an arbitrary provider fails the publish instead of silently dropping
  the variable.
- Add a KinD deployment end-to-end test that deploys a Radius Postgres
  backing resource and verifies the projected connection information.
- Fix stale test class and method references in docs, and scope the
  README credential-replacement warning to legacy Applications.*
  resources.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 62ae7028-e315-4b1d-9d85-e7b58bc1e1f0
rad install kubernetes registers only the built-in namespaces, and the
pinned bicep extension does not carry Radius.Data/postgreSqlDatabases, so
the resource compiled to a classic ARM resource and the deployment engine
routed it to the Azure provider. Register the type with the control plane
and import a locally published extension so the type is deployable, then
deploy the published artifacts directly and assert the password projected
into the consumer both matches the parameter and authenticates.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 62ae7028-e315-4b1d-9d85-e7b58bc1e1f0
- Map SqlServerServerResource to the legacy Applications.Datastores/sqlDatabases
  type with a listSecrets() projection. Radius.Data/sqlDatabases is not a real
  UDT (contrib defines Radius.Data/sqlServerDatabases) and its kube recipe is
  not published, so the emitted type could not resolve at deploy time.
- Reject a parameter used as both the user name and the password of one backing
  resource. Substitutions are keyed by parameter identity, so the later user
  name assignment silently overwrote the password projection.
- Register user-name parameters as recipe credentials on the schema-property
  path so sharing one with a listSecrets()-substituted resource is caught, and
  unwrap nested pass-through ReferenceExpressions when extracting a credential
  parameter (PostgreSQL exposes its user name that way).
- Fail the publish when several databases are declared and none is referenced
  through WithReference, instead of picking the first child; a WithEnvironment
  callback consumer records no annotation, so the choice cannot be proven.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d532fd9b-ea31-4f3e-afa0-2511df99b0ba
The secret-store work that landed on main claimed ASPIRERADIUS061-068, which
collided with the 060-065 range this branch used for backing-resource
projection. Move the backing-resource codes to the free 069-074 range so each
diagnostic still identifies exactly one condition.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d532fd9b-ea31-4f3e-afa0-2511df99b0ba
Detect unrelated uses of a substituted credential parameter where the
substitution is actually applied, during environment resolution, instead
of by pre-scanning ResourceRelationshipAnnotations. The pre-scan could
not see a parameter that only appears inside an EnvironmentCallbackAnnotation
lambda, so that form silently received another resource's recipe secret.
Values splatted from a referenced resource's own connection properties are
matched back to their owner by manifest expression so they are not reported.

Convert a numeric projection to a string before applying a string format in
the composite-expression path. A `:uri`-formatted Radius port previously
emitted uriComponent(resource.properties.port), which fails Bicep type
checking; the lone-projection path already did the conversion.

Name ASPIRERADIUS070 in the unrelated-use warning so it can be mapped to the
diagnostics table, and reject one parameter used as both the user name and
the password on the RecipeInputProperties path. RegisterRecipeCredential only
rejects sharing across different owners, so PostgreSQL previously published
successfully despite the documented restriction.

Correct the Radius Postgres deploy E2E comment: `database` is optional in the
pinned manifest and defaults to postgres_db.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d532fd9b-ea31-4f3e-afa0-2511df99b0ba
A conditional ReferenceExpression carries an empty Format and exposes the
union of both branches' value providers. The publisher's splice therefore
resolved both branches — which can fail the publish on the inactive one —
and then appended no parts, emitting the environment variable as an empty
string. Select the branch first, matching ReferenceExpression.GetValueAsync
and ExpressionResolver.EvalExpressionAsync.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d532fd9b-ea31-4f3e-afa0-2511df99b0ba
…back, README

Narrows the ASPIRERADIUS069 backing-resource guard to address properties only.
Scheme and TlsEnabled are read from the endpoint declaration and describe no
address, so a Radius-owned backing resource can answer them; rejecting them
broke Kubernetes/ACA/App Service consumers that ask only for the scheme. Only
Port and TargetPort need an explicit guard - the other four address properties
reach it through GetHostAddressExpression via the lazy host. Service-port
resolution is now lazy because it allocates a port as a side effect.

Emits the user name as the Postgres 'database' property when a server declares
no AddDatabase(...) child. The server-level connection string carries no
database name, so clients default it to the user name while the recipe would
have defaulted to postgres_db - a consumer with a custom user opened a database
the recipe never created.

Corrects the README claim that legacy rabbitMQQueues is undeployable because
Aspire omits 'queue'. The property is optional and the built-in recipe defaults
it to the Radius resource name.

Adds a regression test for a portless non-HTTP endpoint, confirming the
narrowed catch in the container environment loop does not drop the variable.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 75005945-442c-4e01-bcb8-130f4d6cd1cd
…erequisites

The legacy Applications.Datastores/sqlDatabases recipe takes a `database`
parameter but only echoes it back: the workload it deploys is a SQL Server with
the `sa` login and nothing that runs CREATE DATABASE. AddDatabase(...) creates
the database in run mode only, so a referenced AddSqlServer("sql").AddDatabase
("appdb") handed the consumer a connection string naming a database the
deployment does not contain, with nothing in the output to explain it.

Publishing now warns, scoped to *referenced* database children so an inert
AddDatabase(...) stays silent (matching the ASPIRERADIUS072 precedent). It is a
warning rather than a failure because the publisher cannot provision the
database, the contrib Radius.Data/sqlServerDatabases type that could has no
published Kubernetes recipe, and models whose application creates its own
database (EF Core Migrate/EnsureCreated) deploy successfully today.

Also documents that the PostgreSQL type registration steps are prerequisites
rather than conveniences: against Radius 0.59, a model containing AddPostgres
cannot be deployed by `aspire publish` + `aspire deploy` alone. Radius 0.60
carries Radius.Data/postgreSqlDatabases in the pinned Bicep extension and
registers it by default, so both steps - and the E2E's artifact patching -
disappear once the pinned extension version moves to 0.60.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 75005945-442c-4e01-bcb8-130f4d6cd1cd
… create

A consumer that references a PostgreSQL server rather than one of its databases
receives a connection string with no database name, so it opens the client's
default - the database named after the user - while the recipe creates the
AddDatabase(...) child instead. Run mode hides the mismatch because the Postgres
image creates a database named after POSTGRES_USER alongside the ones Aspire
creates per child, but a recipe provisions exactly one, so the reference is left
pointing at a database that will not exist.

Warns rather than failing, and leaves the child selection alone: the existing
ASPIRERADIUS072 failure exists to protect consumers composed through a
WithEnvironment callback, which record no reference annotation, and picking the
user name here instead would silently break them.

Also corrects the Radius 0.60 notes. Both the README and the E2E comment implied
0.60 makes a PostgreSQL model deploy untouched; it removes the Bicep extension
and type registration steps, but the type is still absent from the default
Kubernetes recipe pack (resource-types-contrib#276), so a recipe registration is
still required.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 75005945-442c-4e01-bcb8-130f4d6cd1cd
- Redis: the local-dev recipe deploys an unauthenticated server and emits
  no `secrets` output, so `listSecrets().password` would fail at deploy
  time. Model it as a new `NoCredential` credential mode that projects an
  empty password and warns with ASPIRERADIUS075.
- Fail the publish (ASPIRERADIUS076) if a recipe input schema does not
  accept the credential properties we must supply, and fall back to
  schema-property assignment when the password is not a bare parameter.
- Only throw for multiple unreferenced databases when the model actually
  has a resource that could have consumed one.
- Reject secondary endpoints explicitly (ASPIRERADIUS077) instead of
  silently projecting them, and split the endpoint diagnostics into
  071/077/079 so the failure mode is identifiable.
- Resolve conditional ReferenceExpression conditions without declaring
  unused Bicep parameters; surface unresolvable conditions as
  ASPIRERADIUS078 and skip just that variable.
- Make the RadiusResourceTypeConstruct credential properties internal and
  document why; add the inner-exception constructor to
  RadiusBackingResourceEndpointException.
- Document the listSecrets()/@secure() trade, the Redis limitation, and
  the new diagnostics in the README.
- E2E: pass the Postgres password through an owner-only ARM parameters
  file rather than the command line, and align the psql retry budget with
  the wait timeout.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: e3a1574a-b750-4a9c-afb0-d952485d6b73
Structural equality of a ReferenceExpression does not establish where the
value came from: an AppHost author can build the same expression, and
`ReferenceExpression.Create($"{shared}")` renders identically to the
owner's `password` connection property when `shared` is that parameter.
Treating equal values as proof of origin suppressed ASPIRERADIUS070 for
exactly the case it exists to report - a user's value silently replaced
by the recipe credential.

Provenance is now taken from the name the connection-property splat
produces for a reference the resource actually declares. The connection
name can be aliased and `WithReference` records the override nowhere, so
the alias is recovered from the `ConnectionStrings__<name>` entry the
same call injects - keeping an aliased reference attributable without
accepting an arbitrary prefix. The value is still compared, as a second
condition rather than the only one.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: e3a1574a-b750-4a9c-afb0-d952485d6b73
Scheme and TlsEnabled describe the container Aspire would have run
locally, while the recipe decides what the deployed workload speaks - and
no mapped Radius type publishes a transport-security output.
`local-dev/rediscaches` starts plain Redis on 6379, so a TLS-enabled
endpoint emitted `rediss://` and `ssl=true` against a plaintext server:
a run-time handshake failure that points at neither the recipe nor the
AppHost.

Unlike a credential the recipe overrides, there is no value here that
becomes correct at deploy time, so this fails the publish with
ASPIRERADIUS081 rather than warning. Only the properties carrying the
decision are rejected (Scheme, TlsEnabled, and Url, which embeds the
scheme); Host, Port, and HostAndPort still project, since the address is
right regardless of transport.

Replaces the previously documented "TLS is read from the Aspire model"
limitation in the README.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: e3a1574a-b750-4a9c-afb0-d952485d6b73
…rences

Two related changes to the Radius publisher.

Radius 0.60 renames the recipe-pack properties `recipeKind`/`recipeLocation`
to `kind`/`source`. The API server silently drops unknown fields, so the old
spelling produces an empty recipe pack with no publish error and no deploy
failure — only a real cluster surfaces it. The rename ships together with the
version pins for that reason. Also on 0.60: Redis and RabbitMQ move off the
legacy `Applications.*` portable types onto their `Radius.*` UDTs, the
RabbitMQ type is `Radius.Messaging/rabbitMQ` (not `rabbitMQQueues`), and
credentials that a UDT consumes by resource ID are carried by a new
`Radius.Security/secrets` resource. The legacy `Applications.Core/environments`
shape is deliberately not renamed — it still uses `templateKind`/`templatePath`.

RabbitMQ now requires an explicit user name (ASPIRERADIUS082). The 0.60 schema
restricts `guest` to loopback connections, so a broker provisioned with the
Aspire default would reject every workload pod, and a default user name reaches
the publisher as literal text inside the connection string with no value to
rewrite — so the broker and the connection string cannot be made to agree.

Separately, container environment variables were always emitted as
`env: { NAME: { value: ... } }`. Routing a credential through an `@secure()`
Bicep param keeps it out of the published artifact, but the resolved string
still lands in the Kubernetes Deployment spec and its rollout history, readable
by anyone with `get deployment` in the namespace. Credential-bearing values are
now emitted as `valueFrom.secretKeyRef` against a per-container
`Radius.Security/secrets` resource.

The whole composed expression moves into the secret rather than the container
referencing a secret-backed fragment through kubelet's `$(VAR)` expansion.
Aspire applies per-fragment percent-encoding via Bicep `uriComponent()` at
deploy time, whereas `$(VAR)` substitutes at pod start — a password containing
`@`, `:` or `/` would silently corrupt a connection string. Keeping composition
in Bicep preserves the escaping exactly.

`Radius.Security/secrets` is recipe-backed, so emitting one obliges the pack to
carry its recipe. The pack is built before container environments are resolved,
so registration is reconciled afterwards (and again after callbacks, which can
add a secret of their own) rather than pre-scanned — resolving an environment
runs the resource's environment callbacks, and a pre-pass would run every user
callback twice.

New diagnostics: ASPIRERADIUS082 (RabbitMQ `guest` user name), ASPIRERADIUS083
(credential in a variable whose name is not a valid Kubernetes secret key), and
ASPIRERADIUS084 (a ConfigureRadiusInfrastructure callback removed a secret, or
a key, that a container reads a credential from).

The KinD end-to-end test now asserts the `secretKeyRef` shape, that the
plaintext is absent from the Deployment JSON, and that the pod process actually
receives the value. It could not be run locally; CI must prove it.

Co-authored-by: Copilot <[email protected]>
Three review threads.

`IComputeEnvironmentResource.GetEndpointPropertyExpression` answered Scheme,
TlsEnabled and Url off the local EndpointAnnotation for a backing resource, so
a Kubernetes/ACA/App Service consumer could be told `rediss`/`TlsEnabled=True`
for a broker whose Radius recipe provisions plaintext transport — the same
mismatch the publisher already rejects as ASPIRERADIUS081. The guard now runs
on this path too, scoped to TLS-enabled endpoints, since no mapped Radius type
publishes a transport-security output for the value to be derived from.

`ToSecretKey` validated Kubernetes Secret data keys with a bare
`[-._a-zA-Z0-9]+` character class, which accepts keys longer than 253
characters as well as `.`, `..` and `..`-prefixed names — all rejected by the
API server. It now reuses `KubernetesName.IsValidSecretDataKey`, which already
carries the complete contract, so an invalid key fails at publish time rather
than when the Secret reaches the cluster.

The PostgreSQL deployment test read `APPDB_PASSWORD` from `.value`, but
credential-bearing variables are now published as `valueFrom.secretKeyRef`, so
that read yields an empty password and psql would fail as an authentication
error. It resolves the referenced Secret name and key and decodes the value,
matching the RabbitMQ test.

Co-authored-by: Copilot <[email protected]>
The Radius deploy E2E failed with RecipeDownloadFailed for both
`ghcr.io/radius-project/kube-recipes/rediscaches:latest` and
`ghcr.io/radius-project/kube-recipes/rabbitmq:latest`: neither tag exists.

resource-types-contrib publishes an immutable `<sha>` tag on every push to
main, refreshes the floating `edge` tag alongside it, and moves `:latest` only
when a recipe ships in a stable release. Its own workflow documents `<sha>` as
"the tag Radius pins against". Both of these recipes post-date the last stable
release, so they have `edge` and SHA tags and no `:latest` — the reference
resolved to a 404, which the publisher cannot detect and which surfaces only
when the deployment engine tries to pull the recipe.

Both are now pinned to ebdeec95, the newest publish carrying both recipes
("Make RabbitMQ password optional"), which is byte-identical to `edge` today:
the manifest digests match for both repositories. `edge` itself is not usable
here because it floats, and an artifact must keep deploying the recipe it was
published against. The other types keep `:latest`, which resolves for them.

Documented in the README as a known limitation, since the SHA is visible in
the recipe pack the publisher emits.

Co-authored-by: Copilot <[email protected]>
…d stale comments

- Drop the Radius.Data/mongoDatabases row from s_defaultRecipeTemplates: it
  pointed a UDT at a legacy recipes/local-dev/ recipe, which both fails to pull
  and ignores the credentials Aspire sets. LegacyMongoDatabases is what the
  mapper emits, and its row already covers it.
- Add EveryEmittedBackingType_HasADefaultRecipeWithAMatchingPrefix so the recipe
  table is held to the same contract as the connection-schema table: total over
  the emitted backing types, with each recipe prefix matching its namespace. That
  catches the Mongo pairing mechanically instead of by inspection.
- Split setup from assertion in the no-plaintext-credential deploy check. `||`
  bound to the whole `&&` chain, so any setup failure short-circuited straight to
  the NOPLAINTEXT_OK marker and reported success without running the grep.
- Cover ASPIRERADIUS086 (an unresolvable connection property fails the publish,
  unlike the container env-var skip) and pin ASPIRERADIUS080's code in the SQL
  database warning test.
- Correct the sqlserverdatabases comment (the ghcr repo does not exist; it does
  not return 403) and the rabbitMQQueues -> rabbitMQ type name in the
  RadiusResourceTypeConstruct doc, and explain why the unreferenced legacy Redis
  and RabbitMQ constants are kept.

Co-authored-by: Copilot <[email protected]>

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 44 out of 45 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/Aspire.Hosting.Radius/Publishing/Constructs/ContainerEnvVarConstruct.cs:57

  • This public construct documents Value and the secret-reference pair as mutually exclusive, but the API neither enforces that union nor provides a way to clear the representation already assigned by the publisher. A customization callback that changes a generated secret-backed variable by assigning Value, or changes a plain variable by assigning SecretName/SecretKey, emits both forms; the Radius container recipe then produces duplicate environment entries and may expose the plain value. Provide an atomic representation switch or validate/reject mixed and incomplete states after callbacks.
    public BicepValue<string> SecretName
    {
        get { Initialize(); return _secretName!; }
        set { Initialize(); _secretName!.Assign(value); }
    }

@github-actions

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.

3 / 102 test projects · 4 jobs, from 45 changed files.

Selected test projects (3 / 102)

Aspire.Cli.EndToEnd.Tests, Aspire.Deployment.EndToEnd.Tests, Aspire.Hosting.Radius.Tests

Selected jobs (4)

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


How these were chosen — grouped by what changed

🔧 src/Aspire.Hosting.Radius/Publishing/BicepPostProcessor.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.Radius/Publishing/Constructs/ContainerEnvVarConstruct.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.Radius/Publishing/Constructs/LegacyApplicationEnvironmentConstruct.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.Radius/Publishing/Constructs/LegacyRecipeEntryConstruct.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.Radius/Publishing/Constructs/RadiusResourceTypeConstruct.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.Radius/Publishing/Constructs/RadiusSecuritySecretConstruct.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.Radius/Publishing/Constructs/RecipeEntryConstruct.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.Radius/Publishing/RadiusBackingConnections.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureOptions.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.Radius/Publishing/RadiusUnresolvableValueException.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

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

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

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

🔧 src/Aspire.Hosting.Radius/ResourceMapping/RadiusResourceTypes.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.Radius/ResourceMapping/ResourceTypeMapper.cs (changed source)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Cli.EndToEnd.Tests/Helpers/KubernetesDeployTestHelpers.cs (changed test)
→ 1 directly: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Cli.EndToEnd.Tests/Helpers/KubernetesE2EVersions.cs (changed test)
→ 1 directly: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Cli.EndToEnd.Tests/RadiusDeployTests.cs (changed test)
→ 1 directly: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Cli.EndToEnd.Tests/RadiusPublishTests.cs (changed test)
→ 1 directly: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Deployment.EndToEnd.Tests/RadiusAzureResourcesDeploymentTests.cs (changed test)
→ 1 directly: Aspire.Deployment.EndToEnd.Tests

🧪 tests/Aspire.Deployment.EndToEnd.Tests/RadiusStarterDeploymentTests.cs (changed test)
→ 1 directly: Aspire.Deployment.EndToEnd.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/DeploymentE2E/DeployEndToEndTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Publishing/BackingResourceContractTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Publishing/BackingResourceProjectionTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Publishing/BackingResourceValueResolutionTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Publishing/BicepGenerationMultiResourceTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Publishing/BicepSyntaxValidationTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Publishing/ConfigureRadiusInfrastructureTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Publishing/ContainerSecretEnvironmentTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Publishing/LegacyFallbackEmissionTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

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

🧪 tests/Aspire.Hosting.Radius.Tests/Recipes/RecipePackParametersBicepTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

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

🧪 tests/Aspire.Hosting.Radius.Tests/ResourceMapping/ResourceTypeMapperTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Snapshots/BackingResourceProjectionTests.AllBackingResourceTypes_ProjectRecipeOutputs.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Snapshots/BackingResourceProjectionTests.CallbackRenamingBackingResource_RewiresProjectedEnvironmentValues.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Snapshots/BackingResourceProjectionTests.DirectEndpointPropertyReference_ProjectsRecipeOutputs.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Snapshots/BackingResourceProjectionTests.UnauthenticatedBackingResource_DoesNotLeakAspireGeneratedPasswordParameter.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Snapshots/BackingResourceValueResolutionTests.UserNameParameter_IsProjectedFromRecipeOutputs.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Snapshots/LegacyFallbackEmissionTests.LegacyAndUdt_ShareResourceNameAndUseDistinctParents.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Snapshots/LegacyFallbackEmissionTests.LegacyOnly_EmitsLegacyParentsAndNoUdtResources.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Snapshots/LegacyFallbackEmissionTests.MixedLegacyAndUdt_EmitsBothParentPairs.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Snapshots/LegacyFallbackEmissionTests.RedisOnly_EmitsLegacyParentsAndNoUdtResources.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

🧪 tests/Aspire.Hosting.Radius.Tests/Snapshots/LegacyFallbackEmissionTests.UdtOnly_DoesNotEmitLegacyParents.verified.bicep (changed test)
→ 1 directly: Aspire.Hosting.Radius.Tests

Job reasons

Job Triggered by
cli-starter selected test Aspire.Cli.EndToEnd.Tests
deployment-e2e tests/Aspire.Deployment.EndToEnd.Tests/RadiusAzureResourcesDeploymentTests.cs, tests/Aspire.Deployment.EndToEnd.Tests/RadiusStarterDeploymentTests.cs
extension-e2e • src/Aspire.Hosting.Radius/Publishing/BicepPostProcessor.cs, src/Aspire.Hosting.Radius/Publishing/Constructs/ContainerEnvVarConstruct.cs, src/Aspire.Hosting.Radius/Publishing/Constructs/LegacyApplicationEnvironmentConstruct.cs, src/Aspire.Hosting.Radius/Publishing/Constructs/LegacyRecipeEntryConstruct.cs, src/Aspire.Hosting.Radius/Publishing/Constructs/RadiusResourceTypeConstruct.cs, src/Aspire.Hosting.Radius/Publishing/Constructs/RadiusSecuritySecretConstruct.cs, src/Aspire.Hosting.Radius/Publishing/Constructs/RecipeEntryConstruct.cs, src/Aspire.Hosting.Radius/Publishing/RadiusBackingConnections.cs, src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs, src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureOptions.cs, src/Aspire.Hosting.Radius/Publishing/RadiusUnresolvableValueException.cs, src/Aspire.Hosting.Radius/RadiusBackingResourceEndpointException.cs, src/Aspire.Hosting.Radius/RadiusBicepExtension.cs, src/Aspire.Hosting.Radius/RadiusEnvironmentResource.cs, src/Aspire.Hosting.Radius/ResourceMapping/RadiusResourceTypes.cs, src/Aspire.Hosting.Radius/ResourceMapping/ResourceTypeMapper.cs, tests/Aspire.Cli.EndToEnd.Tests/Helpers/KubernetesDeployTestHelpers.cs, tests/Aspire.Cli.EndToEnd.Tests/Helpers/KubernetesE2EVersions.cs, tests/Aspire.Cli.EndToEnd.Tests/RadiusDeployTests.cs, tests/Aspire.Cli.EndToEnd.Tests/RadiusPublishTests.cs
• affected project Aspire.Hosting.Radius
typescript-api-compat affected project Aspire.Hosting.Radius

Selection computed for commit b5f35ff.

@nellshamrell
Nell Shamrell-Harrington (nellshamrell) marked this pull request as ready for review August 20, 2026 22:52
@nellshamrell

Copy link
Copy Markdown
Contributor Author

Closing in favour of a fresh PR on the same branch — the discussion here had grown long enough to be hard to follow. No code changes; the same commits are up for review in the successor, and the two unsettled questions (SQL Server database children, and the endpoint-resolution guard) are carried over into its description. This thread stays here for the history.

@nellshamrell

Copy link
Copy Markdown
Contributor Author

Superseded by #19555.

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Radius: backing resources (Redis/Postgres/Mongo/etc.) emit {name}-{name} service discovery that doesn't match the recipe's Service

3 participants