Add connection property suffix - #13471
Conversation
|
Sébastien Ros (@sebastienros) this has conflicts |
0e1685a to
0c8aee4
Compare
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13471Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13471" |
There was a problem hiding this comment.
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:
Database→DatabaseName(SQL Server, PostgreSQL, Oracle, MySQL, MongoDB, Milvus, and Azure variants) - Model properties:
Model→ModelName(OpenAI, GitHub Models, Azure OpenAI, Azure AI Foundry) - Other entity properties:
Organization→OrganizationName,ConsumerGroup→ConsumerGroupName,AuthenticationDatabase→AuthenticationDatabaseName
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: Model → ModelName, Organization → OrganizationName |
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`. |
There was a problem hiding this comment.
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.
| 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`. |
| @@ -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. | | |||
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
| | `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) | |
There was a problem hiding this comment.
Hmm, is this one necessary to suffix with "Name"?
There was a problem hiding this comment.
I was worried this could be interpreted as ID or URL or anything. Because Organization doesn't convey any logical type, like Url/Name.
There was a problem hiding this comment.
Reverted
| { | ||
| yield return new("Password", ReferenceExpression.Create($"{PasswordParameter}")); | ||
| yield return new("AuthenticationDatabase", AuthenticationDatabaseReference); | ||
| yield return new("AuthenticationDatabaseName", AuthenticationDatabaseReference); |
There was a problem hiding this comment.
Check again, I did before and just confirmed again --username myUser --password myPass --authenticationDatabase admin
There was a problem hiding this comment.
So it's a database name, right?
There was a problem hiding this comment.
AuthenticationDatabase tells MongoDB which database stores the user’s account.
There was a problem hiding this comment.
I think since it has more than just "Database" it feels weird to suffix with "Name". AuthenticationDatabase feels like enough.
There was a problem hiding this comment.
Reverted
[skip ci] Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
|
/backport to release/13.1 |
|
Started backporting to release/13.1: https://github.com/dotnet/aspire/actions/runs/20150980883 |


Description
Normalizing all connection property names for better consistency and clarity. Property names now use more explicit suffixes like
Nameto distinguish them from actual values.Pattern Summary
The property name changes follow these patterns:
Database→DatabaseNameAuthenticationDatabase→AuthenticationDatabaseNameModel→ModelName{Entity}→{Entity}Name(e.g.,Organization→OrganizationName,ConsumerGroup→ConsumerGroupName)It's breaking for existing resource that have connection properties after 13.0.
Checklist
<remarks />and<code />elements on your triple slash comments?