Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically persist generated password for all containers with user names and passwords #1151

Closed
DamianEdwards opened this issue Nov 30, 2023 · 6 comments · Fixed by #4507
Assignees
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication enhancement An enhancement to an existing feature or capability.
Milestone

Comments

@DamianEdwards
Copy link
Member

By default today, we auto-generate a password for the SQL Server container when AddSqlServerContainer is called in an AppHost project. A random password on each app start isn't a great experience though as anything created in one session cannot be used in the next if a persistent volume is configured.

We should consider how we might instead automatically manage preservation of the generated password and reuse in subsequent runs, e.g. in user secrets. One challenge of user secrets is it requires initializing the project with an ID (via an MSBuild property in the project file) and modifying the project file while the app is running is probably not a great idea.

@DamianEdwards DamianEdwards added area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication enhancement An enhancement to an existing feature or capability. and removed area-dashboard labels Nov 30, 2023
@mitchdenny
Copy link
Member

@DamianEdwards I've got this PR where I am looking to add secret support to Aspire:

#1487

This PR is the first phase which adds the underlying resource types, but in the comments I've added a note on how this could evolve to provide some increased management around managing container password secrets (as an example). The difference here is that we don't store a generated password, instead we get a password from configuration (locally) which could be in user secrets.

I think that this is a reasonable pay for play compromise? Even if we did want to go further and do generation and storage we'd probably layer it on top of this generic secrets mechanism rather than building it bespoke for each resource?

@mitchdenny mitchdenny self-assigned this Jan 1, 2024
@mitchdenny mitchdenny added this to the preview 3 (Feb) milestone Jan 11, 2024
@mitchdenny
Copy link
Member

Punting to preview 4 because we won't have time to react to some of the discussions from our app model offsite and it will dictate what we do here.

@mitchdenny
Copy link
Member

We discussed this at one of the AppHost syncs. We still want to do this an it's an important building block for container persistence.

@davidfowl davidfowl changed the title Automatically persist generated password for SQL container Automatically persist generated password for all containers with user names and passwords Feb 28, 2024
@davidfowl
Copy link
Member

Related to #2438

@davidfowl
Copy link
Member

Putting this in 8.1. It's important for the volume experience.

DamianEdwards added a commit that referenced this issue Jun 19, 2024
* Save password parameter default values to user secrets

#1151

* Fix copy pasta

* Don't throw if parameter default can't be saved in user secrets

* Revert adding constant

* Update PublicAPI.Unshipped.txt

* Flow AppHost assembly from options to IDistributedApplicationBuilder

* Add tests

* Fix PublicAPI.Unshipped

* More tests

* Save the file with formatting.

* Remove environment check

* PR feedback

* PR feedback

* PR feedback

* Add test for comments in user secrets file case

* Remove the Lazy

---------

Co-authored-by: Mitch Denny <midenn@microsoft.com>
@davidfowl
Copy link
Member

Sweet!

@github-actions github-actions bot locked and limited conversation to collaborators Jul 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication enhancement An enhancement to an existing feature or capability.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants