# AzurePostgresFlexibleServerResource Properties

- Package: [Aspire.Hosting.Azure.PostgreSQL](/reference/api/csharp/aspire.hosting.azure.postgresql.md)
- Type: [AzurePostgresFlexibleServerResource](/reference/api/csharp/aspire.hosting.azure.postgresql/azurepostgresflexibleserverresource.md)
- Kind: `Properties`
- Members: `14`

Represents an resource for Azure Postgres Flexible Server.

## Annotations

- Name: `Annotations`
- Modifiers: `override` `get`
- Returns: `ResourceAnnotationCollection`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L69)

```csharp
public override ResourceAnnotationCollection Annotations { get; }
```

## ConnectionStringExpression

- Name: `ConnectionStringExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L172-L175)

Gets the connection template for the manifest for the Azure Postgres Flexible Server.

```csharp
public ReferenceExpression ConnectionStringExpression { get; }
```

## Databases

- Name: `Databases`
- Modifiers: `get`
- Returns: `IReadOnlyDictionary<string, string>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L208)

A dictionary where the key is the resource name and the value is the database name.

```csharp
public IReadOnlyDictionary<string, string> Databases { get; }
```

## Host

- Name: `Host`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L101-L103)

Gets the host for the PostgreSQL server.

```csharp
public ReferenceExpression Host { get; }
```

## Remarks

In container mode, resolves to the container's primary endpoint host. In Azure mode, resolves to the Azure PostgreSQL server's fully qualified domain name.

## HostName

- Name: `HostName`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L89-L91)

Gets the host name for the PostgreSQL server.

```csharp
public ReferenceExpression HostName { get; }
```

## Remarks

In container mode, resolves to the container's primary endpoint host. In Azure mode, resolves to the Azure PostgreSQL server's fully qualified domain name.

## Id

- Name: `Id`
- Modifiers: `get`
- Returns: `BicepOutputReference`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L48)

Gets the "id" output reference for the resource.

```csharp
public BicepOutputReference Id { get; }
```

## IsContainer

- Name: `IsContainer`
- Modifiers: `get`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L166)

Gets a value indicating whether the current resource represents a container. If so the actual resource is not running in Azure.

```csharp
public bool IsContainer { get; }
```

## JdbcConnectionString

- Name: `JdbcConnectionString`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L201-L203)

Gets the JDBC connection string for the server.

```csharp
public ReferenceExpression JdbcConnectionString { get; }
```

## Remarks

Format: `jdbc:postgresql://{host}:{port}?sslmode=require&authenticationPluginClassName=com.azure.identity.extensions.jdbc.postgresql.AzurePostgresqlAuthenticationPlugin`.

## NameOutputReference

- Name: `NameOutputReference`
- Modifiers: `get`
- Returns: `BicepOutputReference`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L43)

Gets the "name" output reference for the resource.

```csharp
public BicepOutputReference NameOutputReference { get; }
```

## Password

- Name: `Password`
- Modifiers: `nullable` `get`
- Returns: `ReferenceExpression?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L139-L143)

Gets the password for the PostgreSQL server when password authentication is enabled.

```csharp
public ReferenceExpression? Password { get; }
```

## Remarks

This property returns null when using Entra ID (Azure Active Directory) authentication. When password authentication is enabled, it resolves to the password parameter value.

## Port

- Name: `Port`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L113-L115)

Gets the port for the PostgreSQL server.

```csharp
public ReferenceExpression Port { get; }
```

## Remarks

In container mode, resolves to the container's primary endpoint port. In Azure mode, resolves to 5432.

## UriExpression

- Name: `UriExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L152-L160)

Gets the connection URI expression for the PostgreSQL server.

```csharp
public ReferenceExpression UriExpression { get; }
```

## Remarks

Format: `postgresql://{user}:{password}@{host}:{port}`.

## UsePasswordAuthentication

- Name: `UsePasswordAuthentication`
- Modifiers: `get`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L59)

Gets a value indicating whether the resource uses password authentication.

```csharp
public bool UsePasswordAuthentication { get; }
```

## UserName

- Name: `UserName`
- Modifiers: `nullable` `get`
- Returns: `ReferenceExpression?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Azure.PostgreSQL/AzurePostgresFlexibleServerResource.cs#L125-L129)

Gets the user name for the PostgreSQL server when password authentication is enabled.

```csharp
public ReferenceExpression? UserName { get; }
```

## Remarks

This property returns null when using Entra ID (Azure Active Directory) authentication. When password authentication is enabled, it resolves to the user name parameter value.
