Friday, 5 September 2014

How Do I Create a New User in a SQL Azure Database?

Had to look at a few different KB articles for this one so thought I'd throw all the steps together in one quick blog.

First you need to create a login, to do this, connect to the master database and run the following query:

  • CREATE LOGIN login1 WITH password='SuperSecretPassword';

Then connect to the Database you wish to give access to, you need to create the user, then supply the access.  Run the following scripts:

  • CREATE USER login1User FROM LOGIN login1;
  • EXEC sp_addrolemember 'db_owner', 'login1User';

No comments:

Post a Comment