Aspire.Hosting.Azure.PostgreSQL
13.5.2
Prefix Reserved
dotnet add package Aspire.Hosting.Azure.PostgreSQL --version 13.5.2
NuGet\Install-Package Aspire.Hosting.Azure.PostgreSQL -Version 13.5.2
<PackageReference Include="Aspire.Hosting.Azure.PostgreSQL" Version="13.5.2" />
<PackageVersion Include="Aspire.Hosting.Azure.PostgreSQL" Version="13.5.2" />
<PackageReference Include="Aspire.Hosting.Azure.PostgreSQL" />
paket add Aspire.Hosting.Azure.PostgreSQL --version 13.5.2
#r "nuget: Aspire.Hosting.Azure.PostgreSQL, 13.5.2"
#:package Aspire.Hosting.Azure.PostgreSQL@13.5.2
#addin nuget:?package=Aspire.Hosting.Azure.PostgreSQL&version=13.5.2
#tool nuget:?package=Aspire.Hosting.Azure.PostgreSQL&version=13.5.2
Azure Database for PostgreSQL hosting integration
Use this integration to model, configure, and orchestrate Azure Database for PostgreSQL in an Aspire solution.
Getting started
Prerequisites
- Azure subscription - create one for free
Add the integration
From your AppHost directory, add the Aspire.Hosting.Azure.PostgreSQL integration with the Aspire CLI:
aspire add Aspire.Hosting.Azure.PostgreSQL
Configure Azure Provisioning for local development
Adding Azure resources to the AppHost model will automatically enable development-time provisioning
for Azure resources so that you don't need to configure them manually. Provisioning requires a number of settings
to be available via AppHost configuration. From your AppHost directory, set these values with aspire secret set:
aspire secret set Azure:SubscriptionId "<your subscription id>"
aspire secret set Azure:ResourceGroupPrefix "<prefix for the resource group>"
aspire secret set Azure:Location "<azure location>"
NOTE: Developers must have Owner access to the target subscription so that role assignments can be configured for the provisioned resources.
Usage example
In the AppHost, register a Postgres database and reference it from another resource with either C# or TypeScript:
C#
var postgresdb = builder.AddAzurePostgresFlexibleServer("pg")
.AddDatabase("postgresdb");
var myService = builder.AddProject<Projects.MyService>()
.WithReference(postgresdb);
TypeScript
const postgresdb = await builder.addAzurePostgresFlexibleServer("pg")
.addDatabase("postgresdb");
const myService = await builder.addNodeApp("myService", "../my-service", "server.js")
.withReference(postgresdb);
Connection Properties
When you reference Azure PostgreSQL resources using WithReference, the following connection properties are made available to the consuming project:
Azure PostgreSQL flexible server
The Azure PostgreSQL server resource exposes the following connection properties:
| Property Name | Description |
|---|---|
Host |
The hostname for the PostgreSQL server |
Port |
The PostgreSQL port (fixed at 5432 in Azure Flexible Server) |
Uri |
The connection URI for the server, with the format postgresql://{Username}:{Password}@{Host} (credentials omitted when not applicable) |
JdbcConnectionString |
JDBC-format connection string for the server, with the format jdbc:postgresql://{Host}?sslmode=require&authenticationPluginClassName=com.azure.identity.extensions.jdbc.postgresql.AzurePostgresqlAuthenticationPlugin |
Username |
Present when password authentication is enabled; the configured administrator username |
Password |
Present when password authentication is enabled; the configured administrator password |
Azure PostgreSQL database
The Azure PostgreSQL database resource inherits all properties from its parent server and adds:
| Property Name | Description |
|---|---|
DatabaseName |
The name of the database |
Uri |
The database-specific connection URI, with the format postgresql://{Username}:{Password}@{Host}/{DatabaseName} (credentials omitted when not applicable) |
JdbcConnectionString |
JDBC-format connection string for the database, with the format jdbc:postgresql://{Host}/{DatabaseName}?sslmode=require&authenticationPluginClassName=com.azure.identity.extensions.jdbc.postgresql.AzurePostgresqlAuthenticationPlugin |
Aspire exposes each property as an environment variable named [RESOURCE]_[PROPERTY]. For instance, the Uri property of a resource called db1 becomes DB1_URI.
Additional documentation
- https://aspire.dev/integrations/gallery/
- https://aspire.dev/integrations/cloud/azure/azure-postgresql/azure-postgresql-host/
- https://learn.microsoft.com/azure/postgresql/flexible-server/overview
Feedback & contributing
https://github.com/microsoft/aspire
*Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Aspire.Hosting.Azure (>= 13.5.2)
- Aspire.Hosting.Azure.KeyVault (>= 13.5.2)
- Aspire.Hosting.PostgreSQL (>= 13.5.2)
- AspNetCore.HealthChecks.NpgSql (>= 9.0.0)
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- Azure.Core (>= 1.57.0)
- Azure.Identity (>= 1.21.0)
- Azure.Provisioning (>= 1.5.0)
- Azure.Provisioning.KeyVault (>= 1.1.0)
- Azure.Provisioning.PostgreSql (>= 1.1.1)
- Azure.ResourceManager.Authorization (>= 1.1.6)
- Azure.ResourceManager.KeyVault (>= 1.4.0)
- Azure.ResourceManager.Resources (>= 1.11.2)
- Azure.Security.KeyVault.Secrets (>= 4.11.0)
- Google.Protobuf (>= 3.34.1)
- Grpc.AspNetCore (>= 2.80.0)
- Grpc.Net.ClientFactory (>= 2.80.0)
- Grpc.Tools (>= 2.80.0)
- Humanizer.Core (>= 3.0.10)
- JsonPatch.Net (>= 5.0.2)
- KubernetesClient (>= 19.0.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.30)
- Microsoft.Extensions.FileSystemGlobbing (>= 10.0.11)
- Microsoft.Extensions.Hosting (>= 10.0.11)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Http (>= 10.0.11)
- Microsoft.Extensions.Logging (>= 10.0.11)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.11)
- Microsoft.Extensions.Primitives (>= 10.0.11)
- ModelContextProtocol (>= 1.3.0)
- Newtonsoft.Json (>= 13.0.4)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.15.3)
- OpenTelemetry.Extensions.Hosting (>= 1.15.3)
- Polly.Core (>= 8.6.6)
- Semver (>= 3.0.0)
- StreamJsonRpc (>= 2.25.29)
- System.IO.Hashing (>= 10.0.8)
- System.Text.Json (>= 10.0.11)
- YamlDotNet (>= 16.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (4)
Showing the top 4 popular GitHub repositories that depend on Aspire.Hosting.Azure.PostgreSQL:
| Repository | Stars |
|---|---|
|
jasontaylordev/CleanArchitecture
Clean Architecture Solution Template for ASP.NET Core
|
|
|
mehdihadeli/food-delivery-microservices
🍔 A practical and cloud-native food delivery microservices, built with .Net Aspire, .Net 10, Wolverine, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
|
|
|
foxminchan/BookWorm
The practical implementation of Aspire using Microservices, AI-Agents
|
|
|
FritzAndFriends/TagzApp
An application that discovers content on social media for hashtags
|
| Version | Downloads | Last Updated |
|---|---|---|
| 13.5.2 | 180 | 8/21/2026 |
| 13.5.1 | 862 | 8/20/2026 |
| 13.5.0 | 1,928 | 8/18/2026 |
| 13.4.6 | 112,962 | 6/19/2026 |
| 13.4.5 | 9,818 | 6/17/2026 |
| 13.4.4 | 16,941 | 6/15/2026 |
| 13.4.3 | 12,006 | 6/8/2026 |
| 13.4.2 | 8,944 | 6/3/2026 |
| 13.4.1 | 514 | 6/3/2026 |
| 13.4.0 | 3,883 | 6/1/2026 |
| 13.3.5 | 22,672 | 5/21/2026 |
| 13.3.4 | 2,486 | 5/19/2026 |
| 13.3.3 | 5,680 | 5/15/2026 |
| 13.3.2 | 5,097 | 5/14/2026 |
| 13.3.1 | 2,549 | 5/12/2026 |
| 13.3.0 | 21,543 | 5/7/2026 |
| 13.2.4 | 27,261 | 4/24/2026 |
| 13.2.3 | 9,515 | 4/21/2026 |
| 13.2.2 | 32,251 | 4/8/2026 |
| 13.2.1 | 13,465 | 3/31/2026 |