microsoft / microsoft/aspire.dev

[What's New Analysis] Document polyglot connection properties

Open
#338 1 comment 0 reactions 1 assignee View on GitHub

@sebastienros is already working on this.

Since Feb 11, 2026.

external feedback
Dominant language
MDX
Stars
193
Forks
87
Avg merge
1d 22h
Merged PRs (30d)
73

Description

Summary

Aspire 13.0 introduced polyglot-friendly connection properties for database resources, exposing multiple formats (URI, JDBC, individual properties). This is not documented in any database integration doc.

What's Missing

Connection Property Expressions
var postgres = builder.AddPostgres("db").AddDatabase("mydb");

// .NET uses standard connection strings
var dotnetApi = builder.AddProject<Projects.Api>()
    .WithReference(postgres);

// Python uses URI format
var pythonWorker = builder.AddPythonModule("worker", "./worker", "worker.main")
    .WithEnvironment("DATABASE_URL", postgres.Resource.UriExpression);

// Java uses JDBC format
var javaApp = builder.AddExecutable("java-app", ...)
    .WithEnvironment("DB_JDBC", postgres.Resource.JdbcConnectionStringExpression);
Auto-exposed Environment Variables

When using WithReference(), these are automatically set:

  • DB_URI - PostgreSQL URI: postgresql://user:pass@host:port/dbname
  • DB_JDBCCONNECTIONSTRING - JDBC: jdbc:postgresql://host:port/dbname
  • DB_HOST, DB_PORT, DB_USERNAME, DB_PASSWORD, DB_DATABASENAME

Note: JDBC connection string excludes credentials for security.

Suggested Content

  1. Add to each database integration doc - PostgreSQL, MySQL, SQL Server, MongoDB, Oracle
  2. Property reference table - Which properties each resource type exposes
  3. Language-specific examples - Python, Java, Go usage patterns
  4. Security note - JDBC excludes credentials, use separate env vars

Why It Matters

This is THE key feature for polyglot development. Non-.NET developers need to know what environment variables are available.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.