addPostgres

Method
📦 Aspire.Hosting.PostgreSQL v17.0.0
interface IDistributedApplicationBuilder {
// ... omitted for brevity
addPostgres(
name: string,
userName?: ParameterResource,
password?: ParameterResource,
port?: number): PostgresServerResource;
}

Signature

methodaddPostgresbuilder
Adds a PostgreSQL resource to the application model. A container is used for local development.
addPostgres(
name: string,
userName?: ParameterResource,
password?: ParameterResource,
port?: number): PostgresServerResource
namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependency.
userNameParameterResourceoptionalThe parameter used to provide the user name for the PostgreSQL resource. If `null` a default value will be used.
passwordParameterResourceoptionalThe parameter used to provide the administrator password for the PostgreSQL resource. If `null` a random password will be generated.
portnumberoptionalThe host port used when launching the container. If null a random port will be assigned.
PostgresServerResource

Applies to

This method applies to the following types: