Database Reference
In-Depth Information
Note Selecting a strong password is critical when you're running in a cloud environment, even if your database
is used for development or test purposes. Strong passwords and firewall rules are important security defenses
against attacks to your database. Chapter 4 reviews security in depth.
Creating a New User
You can now create a user account for your test login. To do so, connect to a user database using the
administrator account (you can also create a user in the master database if this login should be able to
connect to it), and run the following command:
CREATE USER test FROM LOGIN test
If you attempt to create a user without first creating the login account, you receive a message similar
to the one shown in Figure 1-16.
Figure 1-16. Error when creating a user without creating the login account first
Assigning Access Rights
So far, you've created the login account in the master database and the user account in the user
database. But this user account hasn't been assigned any access rights.
To allow the test account to have unlimited access to the selected user database, you need to assign
the user to the db_owner group:
EXEC sp_addrolemember 'db_owner', 'test'
At this point, you're ready to use the test account to create tables, views, stored procedures, and
more.
Note In SQL Server, user accounts are automatically assigned to the public role. However, in SQL Azure the
public role can't be assigned to user accounts for enhanced security. As a result, specific access rights must be
granted in order to use a user account.
Search WWH ::




Custom Search