AzurePostgresExtensions.WithPasswordAuthentication Method
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 the resource to use password authentication for Azure PostgreSQL Flexible Server.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzurePostgresFlexibleServerResource> WithPasswordAuthentication (this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzurePostgresFlexibleServerResource> builder, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>? userName = default, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>? password = default);
static member WithPasswordAuthentication : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzurePostgresFlexibleServerResource> * Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> * Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzurePostgresFlexibleServerResource>
<Extension()>
Public Function WithPasswordAuthentication (builder As IResourceBuilder(Of AzurePostgresFlexibleServerResource), Optional userName As IResourceBuilder(Of ParameterResource) = Nothing, Optional password As IResourceBuilder(Of ParameterResource) = Nothing) As IResourceBuilder(Of AzurePostgresFlexibleServerResource)
The Azure PostgreSQL server resource builder.
- userName
- IResourceBuilder<ParameterResource>
The parameter used to provide the user name for the PostgreSQL resource. If null
a default value will be used.
- password
- IResourceBuilder<ParameterResource>
The parameter used to provide the administrator password for the PostgreSQL resource. If null
a random password will be generated.
A reference to the IResourceBuilder<T> builder.
The following example creates an Azure PostgreSQL Flexible Server resource that uses password authentication.
var builder = DistributedApplication.CreateBuilder(args);
var data = builder.AddAzurePostgresFlexibleServer("data")
.WithPasswordAuthentication();
builder.AddProject<Projects.ProductService>()
.WithReference(data);
builder.Build().Run();