I am trying to create a stored procedure to create a login and a database user?

后端 未结 4 1235
醉酒成梦
醉酒成梦 2021-01-07 03:58

I am developing a C# application with SQL Server, and would like to call a stored procedure to create a login and a user.

I am looking for the simplest way to do th

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-07 04:15

    You should consider user rights. To create sql server login and database user, you have to have high privileges on SQL Server instance. So either you have to grant user rights to do the action (and that mean- server level and database lever permissions) or you have to use other mechanism not to make your server vulnerable.

    One of the option's would be using certificates and signet stored procedures to do things "nicely" and not allow creation of logins/users directly.

    Also, the one who is able to use trace, will be able to see passwords (if you are not wrapping that in procedure, password is not shown in trace).

提交回复
热议问题