Skip to content

Add connection property suffix - #13471

Merged
Sébastien Ros (sebastienros) merged 5 commits into
mainfrom
sebros/cpnames
Dec 11, 2025
Merged

Add connection property suffix#13471
Sébastien Ros (sebastienros) merged 5 commits into
mainfrom
sebros/cpnames

Conversation

@sebastienros

@sebastienros Sébastien Ros (sebastienros) commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

Description

Normalizing all connection property names for better consistency and clarity. Property names now use more explicit suffixes like Name to distinguish them from actual values.

Pattern Summary

The property name changes follow these patterns:

  1. Database Properties: DatabaseDatabaseName
  2. Authentication Properties: AuthenticationDatabaseAuthenticationDatabaseName
  3. Model Properties: ModelModelName
  4. Named Entities: {Entity}{Entity}Name (e.g., OrganizationOrganizationName, ConsumerGroupConsumerGroupName)

It's breaking for existing resource that have connection properties after 13.0.

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
  • Does the change require an update in our Aspire docs?

Base automatically changed from sebros/azureproperties to main December 10, 2025 21:00
@radical

Copy link
Copy Markdown
Member

Sébastien Ros (@sebastienros) this has conflicts

Copilot AI review requested due to automatic review settings December 10, 2025 21:19
@github-actions

github-actions Bot commented Dec 10, 2025

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/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13471

Or

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

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

This PR normalizes connection property names across all Aspire hosting resources by adding explicit suffixes (primarily Name) to distinguish property names from their values. This is a breaking change for existing resources with connection properties after version 13.0.

Key Changes

  • Database properties: DatabaseDatabaseName (SQL Server, PostgreSQL, Oracle, MySQL, MongoDB, Milvus, and Azure variants)
  • Model properties: ModelModelName (OpenAI, GitHub Models, Azure OpenAI, Azure AI Foundry)
  • Other entity properties: OrganizationOrganizationName, ConsumerGroupConsumerGroupName, AuthenticationDatabaseAuthenticationDatabaseName

Reviewed changes

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

Show a summary per file
File Description
src/Aspire.Hosting.SqlServer/SqlServerDatabaseResource.cs Updated connection property from Database to DatabaseName
src/Aspire.Hosting.SqlServer/README.md Updated documentation to reflect new DatabaseName property
src/Aspire.Hosting.PostgreSQL/PostgresDatabaseResource.cs Updated connection property from Database to DatabaseName
src/Aspire.Hosting.PostgreSQL/README.md Updated documentation to reflect new DatabaseName property
src/Aspire.Hosting.Oracle/OracleDatabaseResource.cs Updated connection property from Database to DatabaseName
src/Aspire.Hosting.Oracle/README.md Updated documentation to reflect new DatabaseName property
src/Aspire.Hosting.OpenAI/OpenAIModelResource.cs Updated connection property from Model to ModelName
src/Aspire.Hosting.OpenAI/README.md Updated documentation to reflect new ModelName property
src/Aspire.Hosting.MySql/MySqlDatabaseResource.cs Updated connection property from Database to DatabaseName
src/Aspire.Hosting.MySql/README.md Updated documentation table and URI format descriptions to use DatabaseName
src/Aspire.Hosting.MongoDB/MongoDBServerResource.cs Updated connection property from AuthenticationDatabase to AuthenticationDatabaseName
src/Aspire.Hosting.MongoDB/MongoDBDatabaseResource.cs Updated connection property from Database to DatabaseName
src/Aspire.Hosting.MongoDB/README.md Updated documentation for both AuthenticationDatabaseName and DatabaseName properties
src/Aspire.Hosting.Milvus/MilvusDatabaseResource.cs Updated connection property from Database to DatabaseName
src/Aspire.Hosting.Milvus/README.md Updated documentation to reflect new DatabaseName property
src/Aspire.Hosting.GitHub.Models/GitHubModelResource.cs Updated connection properties: ModelModelName, OrganizationOrganizationName
src/Aspire.Hosting.GitHub.Models/README.md Updated documentation to reflect both new property names
src/Aspire.Hosting.Azure.Sql/AzureSqlDatabaseResource.cs Updated connection property from Database to DatabaseName
src/Aspire.Hosting.Azure.Sql/README.md Updated documentation to reflect new DatabaseName property
src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerDatabaseResource.cs Updated connection property from Database to DatabaseName
src/Aspire.Hosting.Azure.PostgreSQL/README.md Updated documentation table and connection string descriptions to use DatabaseName
src/Aspire.Hosting.Azure.Kusto/AzureKustoReadWriteDatabaseResource.cs Updated connection property from Database to DatabaseName
src/Aspire.Hosting.Azure.Kusto/README.md Updated documentation table to reflect new DatabaseName property
src/Aspire.Hosting.Azure.EventHubs/AzureEventHubConsumerGroupResource.cs Updated connection property from ConsumerGroup to ConsumerGroupName
src/Aspire.Hosting.Azure.EventHubs/README.md Updated documentation to reflect new ConsumerGroupName property
src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBDatabaseResource.cs Updated connection property from Database to DatabaseName
src/Aspire.Hosting.Azure.CosmosDB/README.md Updated documentation to reflect new DatabaseName property
src/Aspire.Hosting.Azure.CognitiveServices/AzureOpenAIDeploymentResource.cs Updated connection property from Model to ModelName
src/Aspire.Hosting.Azure.CognitiveServices/README.md Updated documentation to reflect new ModelName property
src/Aspire.Hosting.Azure.AIFoundry/AzureAIFoundryDeploymentResource.cs Updated connection property from Model to ModelName
src/Aspire.Hosting.Azure.AIFoundry/README.md Updated documentation and notes to reflect new ModelName property
tests/Aspire.Hosting.SqlServer.Tests/ConnectionPropertiesTests.cs Updated test assertion to expect DatabaseName instead of Database
tests/Aspire.Hosting.PostgreSQL.Tests/ConnectionPropertiesTests.cs Updated test assertion to expect DatabaseName instead of Database
tests/Aspire.Hosting.Oracle.Tests/ConnectionPropertiesTests.cs Updated test assertion to expect DatabaseName instead of Database
tests/Aspire.Hosting.Oracle.Tests/Snapshots/ConnectionPropertiesTests.VerifyManifestWithConnectionProperties.verified.json Updated snapshot with new environment variable name DB_DATABASENAME
tests/Aspire.Hosting.OpenAI.Tests/ConnectionPropertiesTests.cs Updated test assertion to expect ModelName instead of Model
tests/Aspire.Hosting.MySql.Tests/ConnectionPropertiesTests.cs Updated test assertion to expect DatabaseName instead of Database
tests/Aspire.Hosting.MySql.Tests/Snapshots/ConnectionPropertiesTests.VerifyManifestWithConnectionProperties.verified.json Updated snapshot with new environment variable name DB_DATABASENAME
tests/Aspire.Hosting.MongoDB.Tests/ConnectionPropertiesTests.cs Updated test assertions for both AuthenticationDatabaseName and DatabaseName
tests/Aspire.Hosting.MongoDB.Tests/Snapshots/ConnectionPropertiesTests.VerifyManifestWithConnectionProperties.verified.json Updated snapshot with new environment variable names for all database name properties
tests/Aspire.Hosting.Milvus.Tests/ConnectionPropertiesTests.cs Updated test assertion to expect DatabaseName instead of Database
tests/Aspire.Hosting.GitHub.Models.Tests/ConnectionPropertiesTests.cs Updated test assertions for ModelName and OrganizationName
tests/Aspire.Hosting.Azure.Tests/AzureSqlDatabaseConnectionPropertiesTests.cs Updated test assertion to expect DatabaseName instead of Database
tests/Aspire.Hosting.Azure.Tests/AzurePostgresFlexibleServerDatabaseConnectionPropertiesTests.cs Updated test assertions to expect DatabaseName in multiple test methods
tests/Aspire.Hosting.Azure.Tests/AzureOpenAIDeploymentConnectionPropertiesTests.cs Updated test assertion to expect ModelName instead of Model
tests/Aspire.Hosting.Azure.Tests/AzureEventHubConsumerGroupConnectionPropertiesTests.cs Updated test assertion to expect ConsumerGroupName instead of ConsumerGroup
tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBDatabaseConnectionPropertiesTests.cs Updated test assertions to expect DatabaseName in multiple test methods
tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBContainerConnectionPropertiesTests.cs Updated test assertions to expect DatabaseName in multiple test methods
tests/Aspire.Hosting.Azure.Tests/AzureAIFoundryDeploymentConnectionPropertiesTests.cs Updated test assertions to expect ModelName in multiple test methods
tests/Aspire.Hosting.Azure.Kusto.Tests/AzureKustoConnectionPropertiesTests.cs Updated test assertions to expect DatabaseName in multiple test methods

| `Database` | The name of the database |
| `DatabaseName` | The name of the database |

Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `mydb` becomes `MYDB_URI`, and the `Database` property becomes `MYDB_DATABASE`.

Copilot AI Dec 10, 2025

Copy link

Choose a reason for hiding this comment

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

The documentation text still references the old property name Database instead of the new DatabaseName. This should be updated to MYDB_DATABASENAME to match the property name change made in this PR.

Suggested change
Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `mydb` becomes `MYDB_URI`, and the `Database` property becomes `MYDB_DATABASE`.
Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `mydb` becomes `MYDB_URI`, and the `DatabaseName` property becomes `MYDB_DATABASENAME`.

Copilot uses AI. Check for mistakes.
@@ -48,7 +48,7 @@ The SQL Server database resource inherits all properties from its parent `SqlSer
|---------------|-------------|
| `Uri` | The connection URI in mssql:// format, with the format `mssql://{Username}:{Password}@{Host}:{Port}/{DatabaseName}` |
| `JdbcConnectionString` | JDBC connection string with database name, with the format `jdbc:sqlserver://{Host}:{Port};trustServerCertificate=true;databaseName={DatabaseName}`. User and password credentials are provided as separate `Username` and `Password` properties. |

Copilot AI Dec 10, 2025

Copy link

Choose a reason for hiding this comment

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

The JdbcConnectionString example embeds trustServerCertificate=true, which disables SQL Server TLS certificate validation and allows a man-in-the-middle to impersonate the database server if the network is compromised. Because this value is what consuming apps will use by default, an attacker on the same network could intercept or modify database traffic without being detected. Consider removing trustServerCertificate=true from the default connection string, or clearly documenting it as development-only and providing a secure production variant that validates server certificates (e.g., with encrypt=true and a trusted CA-signed certificate).

Copilot uses AI. Check for mistakes.

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.

We already set this property for the dotnet connection string such that the docker images work locally. David Negstad (@danegsta) do we inject certs for SQL Server too now?

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.

No certs for SQL Server yet. We needed to add support for 127.0.0.1 to the dev cert, which'll be in the 10.0.102 SDK. After that ships we can enable HTTPS for SQL Server.

@davidfowl David Fowler (davidfowl) added the breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. label Dec 11, 2025
Comment thread src/Aspire.Hosting.Azure.AIFoundry/README.md Outdated
| `Model` | The model identifier for inference requests, for instance `openai/gpt-4o-mini` |
| `Organization` | The organization attributed to the request (available when configured) |
| `ModelName` | The model identifier for inference requests, for instance `openai/gpt-4o-mini` |
| `OrganizationName` | The organization attributed to the request (available when configured) |

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.

Hmm, is this one necessary to suffix with "Name"?

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 was worried this could be interpreted as ID or URL or anything. Because Organization doesn't convey any logical type, like Url/Name.

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.

image

It's interesting that it use "Repository name" but just has "User or organization"

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.

Reverted

{
yield return new("Password", ReferenceExpression.Create($"{PasswordParameter}"));
yield return new("AuthenticationDatabase", AuthenticationDatabaseReference);
yield return new("AuthenticationDatabaseName", AuthenticationDatabaseReference);

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.

Maybe this one doesn't need to be updated since it has a qualifier.

Image

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.

Check again, I did before and just confirmed again --username myUser --password myPass --authenticationDatabase admin

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.

So it's a database name, right?

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.

AuthenticationDatabase tells MongoDB which database stores the user’s account.

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.

I think since it has more than just "Database" it feels weird to suffix with "Name". AuthenticationDatabase feels like enough.

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.

Reverted

@sebastienros
Sébastien Ros (sebastienros) merged commit ff437b1 into main Dec 11, 2025
286 checks passed
@sebastienros
Sébastien Ros (sebastienros) deleted the sebros/cpnames branch December 11, 2025 23:36
@dotnet-policy-service dotnet-policy-service Bot added this to the 13.2 milestone Dec 11, 2025
@sebastienros

Copy link
Copy Markdown
Contributor Author

/backport to release/13.1

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/13.1: https://github.com/dotnet/aspire/actions/runs/20150980883

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

Labels

breaking-change Issue or PR that represents a breaking API or functional change over a prerelease.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants