views:

75

answers:

2

Hi,

Is there any API SQL Server 2008 offers for .net application to create and grant access authorities? Thanks!

+1  A: 

T-SQL has CREATE USER and other related commands which can be used to create user and/or to GRANT various privileges. This can be invoked directly from ADO.

This works for SQL accounts, if you are using the "integrated" security model, you'll need to add new accounts at the level of the OS / Active Directory.

mjv
Okay, Thanks! Would you like to provide some food for thought about the integrated security model? I'm going to add a existing LDAP account.
Roy
To create AD Account, you may look in to ADSI (Active Directory Service Interface) which is a COM interface. You may also be able to do this without COM, see http://msdn.microsoft.com/en-us/library/ms675773%28VS.85%29.aspx.
mjv
+1  A: 

A .Net specific API for SQL administration is SMO. See Managing Users, Roles, and Logins. To create a new login you call the Login.Create method.

Remus Rusanu