Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds a PostgreSQL resource to the application model. A container is used for local development.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.PostgresServerResource> AddPostgres(this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>? userName = default, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>? password = default, int? port = default);
static member AddPostgres : Aspire.Hosting.IDistributedApplicationBuilder * string * Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> * Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> * Nullable<int> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.PostgresServerResource>
<Extension()>
Public Function AddPostgres (builder As IDistributedApplicationBuilder, name As String, Optional userName As IResourceBuilder(Of ParameterResource) = Nothing, Optional password As IResourceBuilder(Of ParameterResource) = Nothing, Optional port As Nullable(Of Integer) = Nothing) As IResourceBuilder(Of PostgresServerResource)
The name of the resource. This name will be used as the connection string name when referenced in a dependency.
The parameter used to provide the user name for the PostgreSQL resource. If null
a default value will be used.
The parameter used to provide the administrator password for the PostgreSQL resource. If null
a random password will be generated.
The host port used when launching the container. If null a random port will be assigned.
A reference to the IResourceBuilder<T>.
This resource includes built-in health checks. When this resource is referenced as a dependency using the WaitFor<T>(IResourceBuilder<T>, IResourceBuilder<IResource>) extension method then the dependent resource will wait until the Postgres resource is able to service requests.
This version of the package defaults to the <inheritdoc cref="F:Aspire.Hosting.Postgres.PostgresContainerImageTags.Tag"></inheritdoc> tag of the <inheritdoc cref="F:Aspire.Hosting.Postgres.PostgresContainerImageTags.Image"></inheritdoc> container image.
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in