Skip to content

Setting a permanent password for MSSQL SA account #4377

Answered by davidfowl
Dazfl asked this question in Q&A
Discussion options

You must be logged in to vote

This is where you use parameters in the application model. If you look at the overloads of AddSqlServer, you'll see there's a password parameter that takes an IResourceBuilder<ParameterResource>.

var password = builder.AddParameter("sqlPass", secret: true);

var db = builder.AddSqlServer("test-sql-server", port: 54478, password: password)
    .AddDatabase("test-db", "test");
 
var api = builder.AddProject<Projects.Test_Api>("test-api")
    .WithReference(db);

The value for this parameter should be set in user secrets. Parameters are read from configuration in the format "Parameters:parametername", so the above would be "Parameters:sqlPass".

You can learn more about parameters here https:/…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by davidfowl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants