AzurePostgresExtensions.RunAsContainer Method
Definition
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.
Configures an Azure PostgreSQL Flexible Server resource to run locally in a container.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzurePostgresFlexibleServerResource> RunAsContainer (this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzurePostgresFlexibleServerResource> builder, Action<Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.PostgresServerResource>>? configureContainer = default);
static member RunAsContainer : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzurePostgresFlexibleServerResource> * Action<Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.PostgresServerResource>> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzurePostgresFlexibleServerResource>
<Extension()>
Public Function RunAsContainer (builder As IResourceBuilder(Of AzurePostgresFlexibleServerResource), Optional configureContainer As Action(Of IResourceBuilder(Of PostgresServerResource)) = Nothing) As IResourceBuilder(Of AzurePostgresFlexibleServerResource)
Parameters
The Azure PostgreSQL server resource builder.
- configureContainer
- Action<IResourceBuilder<PostgresServerResource>>
Callback that exposes underlying container to allow for customization.
Returns
A reference to the IResourceBuilder<T> builder.
Examples
The following example creates an Azure PostgreSQL Flexible Server resource that runs locally in a PostgreSQL container and referencing that resource in a .NET project.
var builder = DistributedApplication.CreateBuilder(args);
var data = builder.AddAzurePostgresFlexibleServer("data")
.RunAsContainer();
builder.AddProject<Projects.ProductService>()
.WithReference(data);
builder.Build().Run();