microsoft / microsoft/aspire

Support altering the default script for AzurePostgresFlexibleServer in .NET Aspire

Open
#9,013 10 comments 0 reactions 0 assignees View on GitHub
area-integrations azure postgres
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

Currently, the `AddAzurePostgresFlexibleServer(...).AddDatabase(...).WithCreationScript(...)` API works well, but it returns an `IResourceBuilder` which is not compatible with `PostgresDatabaseResource`. This inconsistency makes it difficult to generalize database setup logic (e.g., if switching between local Postgres and Azure).

**Screenshot of the error for reference:**

![Image](https://github.com/user-attachments/assets/86709390-1818-4f43-b93e-290549b7dea2)

![Image](https://github.com/user-attachments/assets/ca011aa9-bf96-4722-ba78-5358e8dafed3)

### Describe the solution you'd like

It would be helpful if:

- **There was a unified interface for database resources.**
- **Or better guidance/docs/examples for using `WithCreationScript` in the `AzurePostgresFlexibleServer` scenario.**

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.