0

I followed the basic example tutorial from Microsoft on how to publish an ASP.NET Core app to Azure with visual studio (https://learn.microsoft.com/pt-br/aspnet/core/tutorials/publish-to-azure-webapp-using-vs?view=aspnetcore-3.1)

There is this part where I configure the Azure SQL Database entering the administrator username and password. After that, I have to configure the database connection string. They say "Best practice is to avoid using the same details as the admin username & password used in the previous step."

But, I couldn't figure out how to use a different username and password than the administrator ones. How can I create a connection string which uses a different username/password? At the Azure control panel, I see the connection string with the admin username already. Can I create another connection string for other users?

This is the one that works, with admin user/pass

Data Source=tcp:xxxwebapplicationdbserver.database.windows.net,1433;Initial Catalog=xxx;User Id=xxx@xxxwebapplicationdbserver;Password={mypass}

1 Answer 1

0

You need to create a new user on your Azure SQL database with the minimum required permissions for your app. That will give you a username and password that you can use in your deployed app.

The basic script is:

CREATE LOGIN login_name WITH PASSWORD = 'strong_password';
GRANT SELECT ON OBJECT::HumanResources.Employee TO Larry;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.