Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionSt
{
var model = Parent.IsEmulator ? ModelId ?? ModelName : DeploymentName;
return Parent.CombineProperties([
new("Model", ReferenceExpression.Create($"{model}")),
new("ModelName", ReferenceExpression.Create($"{model}")),
new("Format", ReferenceExpression.Create($"{Format}")),
new("Version", ReferenceExpression.Create($"{ModelVersion}")),
]);
Expand Down
4 changes: 2 additions & 2 deletions src/Aspire.Hosting.Azure.AIFoundry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ The Azure AI Foundry deployment resource inherits all properties from its parent

| Property Name | Description |
|---------------|-------------|
| `Model` | The deployment name when targeting Azure or model identifier when running Foundry Local, e.g., `Phi-4`, `my-chat` |
| `ModelName` | The deployment name when targeting Azure or model identifier when running Foundry Local, e.g., `Phi-4`, `my-chat` |
Comment thread
sebastienros marked this conversation as resolved.
Outdated
| `Format` | The deployment format, .e.g., `OpenAI`, `Microsoft`, `xAi`, `Deepseek` |
| `Version` | The deployment version, e.g., `1`, `2025-08-07` |

Note: The property named `Model` refers to the deployment name when targeting Azure AI Foundry, but to the model identifier when running Foundry Local.
Note: The property named `ModelName` refers to the deployment name when targeting Azure AI Foundry, but to the model identifier when running Foundry Local.

Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `chat` becomes `CHAT_URI`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionSt
yield return property;
}

yield return new("Model", ReferenceExpression.Create($"{DeploymentName}"));
yield return new("ModelName", ReferenceExpression.Create($"{DeploymentName}"));
}

private static string ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Azure.CognitiveServices/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ The Azure OpenAI deployment resource inherits all properties from its parent Azu

| Property Name | Description |
|---------------|-------------|
| `Model` | The name of the Azure OpenAI deployment, e.g., `chat` |
| `ModelName` | The name of the Azure OpenAI deployment, e.g., `chat` |

Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `chat` becomes `CHAT_URI`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionSt
yield return property;
}

yield return new("Database", ReferenceExpression.Create($"{DatabaseName}"));
yield return new("DatabaseName", ReferenceExpression.Create($"{DatabaseName}"));
}
}
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Azure.CosmosDB/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The Cosmos DB database resource inherits all properties from its parent Cosmos D

| Property Name | Description |
|---------------|-------------|
| `Database` | The name of the database |
| `DatabaseName` | The name of the database |

### Cosmos DB container

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionSt
yield return property;
}

yield return new("ConsumerGroup", ReferenceExpression.Create($"{ConsumerGroupName}"));
yield return new("ConsumerGroupName", ReferenceExpression.Create($"{ConsumerGroupName}"));
}
}
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Azure.EventHubs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The Event Hub consumer group resource inherits all properties from its parent Ev

| Property Name | Description |
|---------------|-------------|
| `ConsumerGroup` | The name of the consumer group |
| `ConsumerGroupName` | The name of the consumer group |

Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `db1` becomes `DB1_URI`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionSt
yield return property;
}

yield return new("Database", ReferenceExpression.Create($"{DatabaseName}"));
yield return new("DatabaseName", ReferenceExpression.Create($"{DatabaseName}"));
}
}
}
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Azure.Kusto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ When you reference Azure Kusto resources using `WithReference`, the following co
| Property Name | Description |
|---------------|-------------|
| `Uri` | The cluster endpoint URI (inherited from parent cluster) |
| `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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ internal void SetInnerResource(PostgresDatabaseResource innerResource)

IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties() =>
Parent.CombineProperties([
new("Database", ReferenceExpression.Create($"{DatabaseName}")),
new("DatabaseName", ReferenceExpression.Create($"{DatabaseName}")),
new("Uri", UriExpression),
new("JdbcConnectionString", JdbcConnectionString),
]);
Expand Down
6 changes: 3 additions & 3 deletions src/Aspire.Hosting.Azure.PostgreSQL/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ The Azure PostgreSQL database resource inherits all properties from its parent s

| Property Name | Description |
|---------------|-------------|
| `Database` | The name of the database |
| `Uri` | The database-specific connection URI, with the format `postgresql://{Username}:{Password}@{Host}/{Database}` (credentials omitted when not applicable) |
| `JdbcConnectionString` | JDBC-format connection string for the database, with the format `jdbc:postgresql://{Host}/{Database}?sslmode=require&authenticationPluginClassName=com.azure.identity.extensions.jdbc.postgresql.AzurePostgresqlAuthenticationPlugin` |
| `DatabaseName` | The name of the database |
| `Uri` | The database-specific connection URI, with the format `postgresql://{Username}:{Password}@{Host}/{DatabaseName}` (credentials omitted when not applicable) |
| `JdbcConnectionString` | JDBC-format connection string for the database, with the format `jdbc:postgresql://{Host}/{DatabaseName}?sslmode=require&authenticationPluginClassName=com.azure.identity.extensions.jdbc.postgresql.AzurePostgresqlAuthenticationPlugin` |

Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `db1` becomes `DB1_URI`.

Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Azure.Sql/AzureSqlDatabaseResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ internal void SetInnerResource(SqlServerDatabaseResource innerResource)
IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties() =>
Parent.CombineProperties(
[
new ("Database", ReferenceExpression.Create($"{DatabaseName}")),
new ("DatabaseName", ReferenceExpression.Create($"{DatabaseName}")),
new ("Uri", UriExpression),
new ("JdbcConnectionString", JdbcConnectionString),
]);
Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Azure.Sql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The Azure SQL database resource inherits all properties from its parent Azure SQ

| Property Name | Description |
|---------------|-------------|
| `Database` | The name of the database |
| `DatabaseName` | The name of the database |
| `Uri` | The connection URI, with the format `mssql://{Host}:{Port}/{DatabaseName}` |
| `JdbcConnectionString` | JDBC connection string with the format `jdbc:sqlserver://{Host}:{Port};database={DatabaseName};encrypt=true;trustServerCertificate=false`; |

Expand Down
4 changes: 2 additions & 2 deletions src/Aspire.Hosting.GitHub.Models/GitHubModelResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionSt
{
yield return new("Uri", UriExpression);
yield return new("Key", ReferenceExpression.Create($"{Key}"));
yield return new("Model", ReferenceExpression.Create($"{Model}"));
yield return new("ModelName", ReferenceExpression.Create($"{Model}"));

if (Organization is not null)
{
yield return new("Organization", ReferenceExpression.Create($"{Organization}"));
yield return new("OrganizationName", ReferenceExpression.Create($"{Organization}"));
}
}
}
4 changes: 2 additions & 2 deletions src/Aspire.Hosting.GitHub.Models/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ The GitHub Model resource exposes the following connection properties:
|---------------|-------------|
| `Uri` | The GitHub Models inference endpoint URI, with the format `https://models.github.ai/inference` |
| `Key` | The API key (PAT or GitHub App token) for authentication |
| `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


Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `chat` becomes `CHAT_URI`.

Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Milvus/MilvusDatabaseResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ private static string ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgu

IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties() =>
Parent.CombineProperties([
new("Database", ReferenceExpression.Create($"{DatabaseName}"))
new("DatabaseName", ReferenceExpression.Create($"{DatabaseName}"))
]);
}
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Milvus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The Milvus database resource combines the server properties above and adds the f

| Property Name | Description |
|---------------|-------------|
| `Database` | The Milvus database name |
| `DatabaseName` | The Milvus database name |

Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `db1` becomes `DB1_URI`.

Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.MongoDB/MongoDBDatabaseResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private static string ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgu

IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties() =>
Parent.CombineProperties([
new("Database", ReferenceExpression.Create($"{DatabaseName}")),
new("DatabaseName", ReferenceExpression.Create($"{DatabaseName}")),
new("Uri", UriExpression),
]);
}
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.MongoDB/MongoDBServerResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionSt
if (PasswordParameter is not null)
{
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

yield return new("AuthenticationMechanism", AuthenticationMechanismReference);
}

Expand Down
6 changes: 3 additions & 3 deletions src/Aspire.Hosting.MongoDB/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ The MongoDB server resource exposes the following connection properties:
| `Port` | The port number the MongoDB server is listening on |
| `Username` | The username for authentication |
| `Password` | The password for authentication (available when a password parameter is configured) |
| `AuthenticationDatabase` | The authentication database (available when a password parameter is configured) |
| `AuthenticationDatabaseName` | The authentication database (available when a password parameter is configured) |
| `AuthenticationMechanism` | The authentication mechanism (available when a password parameter is configured) |
| `Uri` | The connection URI, with the format `mongodb://{Username}:{Password}@{Host}:{Port}/?authSource={AuthenticationDatabase}&authMechanism={AuthenticationMechanism}` |
| `Uri` | The connection URI, with the format `mongodb://{Username}:{Password}@{Host}:{Port}/?authSource={AuthenticationDatabaseName}&authMechanism={AuthenticationMechanism}` |

### MongoDB database

The MongoDB database resource combines the server properties above and adds the following connection property:

| Property Name | Description |
|---------------|-------------|
| `Database` | The MongoDB database name |
| `DatabaseName` | The MongoDB database name |

Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `db1` becomes `DB1_URI`.

Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.MySql/MySqlDatabaseResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private static string ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgu

IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties() =>
Parent.CombineProperties([
new("Database", ReferenceExpression.Create($"{DatabaseName}")),
new("DatabaseName", ReferenceExpression.Create($"{DatabaseName}")),
new("Uri", UriExpression),
new("JdbcConnectionString", JdbcConnectionString),
]);
Expand Down
6 changes: 3 additions & 3 deletions src/Aspire.Hosting.MySql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ The MySQL database resource combines the server properties above and adds the fo

| Property Name | Description |
|---------------|-------------|
| `Database` | The MySQL database name |
| `Uri` | The database-specific URI, with the format `mysql://root:{Password}@{Host}:{Port}/{Database}` |
| `JdbcConnectionString` | The database-specific JDBC connection string, with the format `jdbc:mysql://{Host}:{Port}/{Database}`. User and password credentials are provided as separate `Username` and `Password` properties. |
| `DatabaseName` | The MySQL database name |
| `Uri` | The database-specific URI, with the format `mysql://root:{Password}@{Host}:{Port}/{DatabaseName}` |
| `JdbcConnectionString` | The database-specific JDBC connection string, with the format `jdbc:mysql://{Host}:{Port}/{DatabaseName}`. User and password credentials are provided as separate `Username` and `Password` properties. |

Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `db1` becomes `DB1_URI`.

Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.OpenAI/OpenAIModelResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ public OpenAIModelResource(string name, string model, OpenAIResource parent) : b

IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties() =>
Parent.CombineProperties([
new("Model", ReferenceExpression.Create($"{Model}")),
new("ModelName", ReferenceExpression.Create($"{Model}")),
]);
}
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.OpenAI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ The OpenAI model resource combines the parent properties above and adds the foll

| Property Name | Description |
|---------------|-------------|
| `Model` | The model identifier for inference requests, for instance `gpt-4o-mini` |
| `ModelName` | The model identifier for inference requests, for instance `gpt-4o-mini` |

Aspire exposes each property as an environment variable named `[RESOURCE]_[PROPERTY]`. For instance, the `Uri` property of a resource called `chat` becomes `CHAT_URI`.

Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Oracle/OracleDatabaseResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private static string ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgu

IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties() =>
Parent.CombineProperties([
new("Database", ReferenceExpression.Create($"{DatabaseName}")),
new("DatabaseName", ReferenceExpression.Create($"{DatabaseName}")),
new("Uri", UriExpression),
new("JdbcConnectionString", JdbcConnectionString),
]);
Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Oracle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The Oracle database resource inherits all properties from its parent `OracleData
|---------------|-------------|
| `Uri` | The connection URI in oracle:// format, with the format `oracle://{Username}:{Password}@{Host}:{Port}/{DatabaseName}` |
| `JdbcConnectionString` | JDBC connection string with database name, with the format `jdbc:oracle:thin:@//{Host}:{Port}/{DatabaseName}`. User and password credentials are provided as separate `Username` and `Password` properties. |
| `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 `db1` becomes `DB1_URI`.

Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.PostgreSQL/PostgresDatabaseResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private static string ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgu

IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties() =>
Parent.CombineProperties([
new("Database", ReferenceExpression.Create($"{DatabaseName}")),
new("DatabaseName", ReferenceExpression.Create($"{DatabaseName}")),
new("Uri", UriExpression),
new("JdbcConnectionString", JdbcConnectionString),
]);
Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.PostgreSQL/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The PostgreSQL database resource inherits all properties from its parent `Postgr
|---------------|-------------|
| `Uri` | The connection URI with the database name, with the format `postgresql://{Username}:{Password}@{Host}:{Port}/{DatabaseName}` |
| `JdbcConnectionString` | JDBC connection string with database name, with the format `jdbc:postgresql://{Host}:{Port}/{DatabaseName}`. User and password credentials are provided as separate `Username` and `Password` properties. |
| `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 `db1` becomes `DB1_URI`.

Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.SqlServer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

| `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 `db1` becomes `DB1_URI`.

Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.SqlServer/SqlServerDatabaseResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private static string ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgu

IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties() =>
Parent.CombineProperties([
new("Database", ReferenceExpression.Create($"{DatabaseName}")),
new("DatabaseName", ReferenceExpression.Create($"{DatabaseName}")),
new("Uri", UriExpression),
new("JdbcConnectionString", JdbcConnectionString),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void AzureKustoDatabaseResourceGetConnectionPropertiesReturnsExpectedValu
},
property =>
{
Assert.Equal("Database", property.Key);
Assert.Equal("DatabaseName", property.Key);
Assert.Equal("testdb", property.Value.ValueExpression);
});
}
Expand All @@ -85,7 +85,7 @@ public void AzureKustoDatabaseResourceWithEmulatorGetConnectionPropertiesReturns
},
property =>
{
Assert.Equal("Database", property.Key);
Assert.Equal("DatabaseName", property.Key);
Assert.Equal("testdb", property.Value.ValueExpression);
});
}
Expand Down
Loading
Loading