Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Creating SQL Server logins and switching authentication modes

From: SQL Server 2008 Essential Training

Video: Creating SQL Server logins and switching authentication modes

One of the best practice for defining your principals is to make sure that they already exist as users on your domain or on your local machine and that way we're using Windows authentication as that first barrier to entry, they have to have logged on to your machine or to your domain to get there, it's not the only choice that we have. When I'm creating a new login one of the options I'll have here is to switch from Windows Authentication to SQL Server Authentication. This is not a minor difference. This is a big deal.

Creating SQL Server logins and switching authentication modes

One of the best practice for defining your principals is to make sure that they already exist as users on your domain or on your local machine and that way we're using Windows authentication as that first barrier to entry, they have to have logged on to your machine or to your domain to get there, it's not the only choice that we have. When I'm creating a new login one of the options I'll have here is to switch from Windows Authentication to SQL Server Authentication. This is not a minor difference. This is a big deal.

With Windows Authentication selected the login name that I type has to exist outside. It must exist on this machine or on that domain. When I select SQL Server Authentication it really means define a new user, give them a name, give them a password. They didn't exist before. I'm just writing them and they may now exist in SQL Server. A very common reason to do this is that you have, for example, a web service application, something that needs to connect to this machine, but because of the way your network is setup it can not actually authenticate as legitimate Windows user.

They might be running on a Linux box, they might be running as a Java application. They're outside your firewall and they can't logon as a Windows user. They need to connect with a username and a password. So we'll set this up. We'll give them the name WebServiceApplication and I'm going to type in a password here. I'm going to uncheck the user must change password at next login. In case this was an application was connecting, we don't want to throw that problem in their way, and it's up to you whether you want to enforce password expiration and so on.

All the other choices that we have are the same. Do I want to give this new user any server role? And no I don't and in fact the only thing I'm going to give them is the ability to read from AdventureWorksLT. So I'll switch to my User Mapping, I'll select the box beside AdventureWorksLT, and I'll give this user the db_datareader role and click OK. If I expand Logins I'll see that user listed there. Again this user has not been created on this machine, he is not a Windows user, not a domain account.

He only exists inside SQL Server and the question is well, prove it. What can that user actually do? Well we can actually emulate that and try and log on to this database as that user. I'm going to click this button up in my Object Explorer that says Connect Object Explorer and it throws up the usual dialog box we've seen. What I'm going to say is instead of connecting as me I want to connect to the same machine using SQL Server authentication, and I had an old account there, but I'm going to type WebServiceApplication and type in the password that I had and click Connect.

We're going to have a problem. Now it just says login failed for user WebServiceApplication and I perhaps could think maybe I type my password wrongly, maybe I type the name wrongly, does it need some prefix, and unfortunately the problem is a bit bigger than that. Here's the issue. If I go back and I'm still connected as myself right now, so I do have admin privileges. I'm going to right-click the Instance and click Properties. I am looking at the properties of SQL Server instance on this machine. Now if I come down to Security I'll see that my server authentication is a Windows Authentication mode. That means in order to log on to this machine I have to be a Windows account.

Now you might think, well why did it let me create a SQL Server account then? Well, it could be useful. You might want to set up several SQL Server accounts but you're not actually going to switch your authentication mode until you're ready to go live. So it's perfectly acceptable. But I need to switch it so I can check it. You can do this after the fact, but it's a fairly significant switch. You wouldn't want to do it in the middle of a busy day because as soon as I select this and click OK, it's going to tell me that my configuration change will not take effect until SQL Server is restarted.

Well it's just me so I can restart it. I'm going to drill down into my SQL Server 2008 R2 programs, find my Configuration Tools, and open up SQL Server Configuration Manager. The only thing I need to restart is the SQL Server Engine itself which shows up as this SQL Server address and I have the choice of hitting the Stop button and then waiting and then clicking Play, but we do have a little Restart Service buttons as well. Right-click would work too. This will take just a moment because it's a small server, and when it's done we can close Configuration Manager.

That's the only thing we needed it for and I'm going to try to connect again. I'll click this button. I'll say that I want to use a SQL Server Authentication and the accounts I had set up was Web ServiceApplication, type in the password, and connect, and we're connected successful. In fact right now we're connected twice. This top row in the Object Explorer is telling me I'm logged on as myself with Windows authentication and this is the view of it we'd that would log on as the SQL account and that should be a lot more restricted.

For example if I drill down onto the databases and think, well maybe I'll take a look at AdventureWorks, well I don't get to see that one. I don't get to see AdventureWorks data warehouse or data warehouse 2008 R2. I do get to expand AdventureWorksLT. I do get to expand Tables. I could even right-click and say I want to select the Top 1000 Rows because I'm allowed to read from this database. It would give me the ability to right- click and say Edit Top 200 Rows, but if I actually try to do something here like change the title, it's actually going to throw an exception here that the UPDATE permission was denied on that object.

I don't have permission to write to this database. So it wouldn't let me save this so I'm just going to hit the Escape key to jump out of having that change in there. I'm going to go back and just disconnect this part again. Disconnect as being the WebServiceApplication and just go back to being a regular administrator here. Again one of the things you want to be very careful of is when you're using SQL Server accounts and you're allowing that login ability of just a username and password, that you are using complex passwords and even complex user names as well, but if you do have to expose your connection this way, this is the way to create them.

Show transcript

This video is part of

Image for SQL Server 2008 Essential Training
SQL Server 2008 Essential Training

74 video lessons · 36674 viewers

Simon Allardice
Author

 
Expand all | Collapse all
  1. 2m 21s
    1. Welcome
      1m 19s
    2. Using the exercise files
      1m 2s
  2. 17m 58s
    1. SQL Server core concepts
      9m 4s
    2. SQL Server editions
      3m 8s
    3. Applications included with SQL Server
      5m 46s
  3. 26m 1s
    1. Preparing for installation
      3m 44s
    2. Creating service accounts
      2m 33s
    3. Installing SQL Server
      11m 42s
    4. Post-installation checks
      3m 9s
    5. Installing sample databases
      4m 53s
  4. 13m 35s
    1. Introduction to SQL Server Management Studio
      8m 7s
    2. Introduction to SQL Server Books Online
      3m 6s
    3. SQL Server system databases
      2m 22s
  5. 1h 26m
    1. Planning your database
      9m 39s
    2. Creating a SQL Server database
      4m 7s
    3. Creating tables
      7m 51s
    4. Data types in SQL Server
      12m 25s
    5. Defining keys
      8m 9s
    6. Creating default values
      4m 39s
    7. Creating check constraints
      2m 25s
    8. Creating unique constraints
      4m 34s
    9. Introduction to relationships and foreign keys
      9m 51s
    10. Creating relationships in SQL Server Management Studio
      8m 14s
    11. Database normalization
      11m 47s
    12. Creating computed columns
      3m 10s
  6. 23m 11s
    1. Using the SQL Server Import and Export Wizard
      3m 58s
    2. Importing Excel files into SQL Server
      6m 11s
    3. Importing CSV files into SQL Server
      5m 27s
    4. Importing Access databases into SQL Server
      7m 35s
  7. 55m 29s
    1. Introduction to Transact-SQL
      3m 43s
    2. Using SELECT statements
      7m 16s
    3. Changing the default database
      2m 21s
    4. Creating conditions in SQL
      8m 10s
    5. Sorting your output
      3m 23s
    6. Using aggregate functions
      7m 12s
    7. Finding unique values
      2m 14s
    8. Joining multiple tables together
      8m 0s
    9. Using subqueries
      9m 33s
    10. Viewing execution plans
      3m 37s
  8. 19m 36s
    1. Writing INSERT statements
      5m 47s
    2. Writing UPDATE statements
      4m 38s
    3. Writing DELETE statements
      2m 54s
    4. Using the OUTPUT clause to return inserted keys and GUIDs
      6m 17s
  9. 32m 52s
    1. Introduction to SQL functions
      6m 26s
    2. Using SQL configuration functions
      2m 14s
    3. Using string functions
      7m 26s
    4. Using date functions
      6m 27s
    5. Creating user-defined functions
      10m 19s
  10. 28m 46s
    1. Introduction to stored procedures
      4m 23s
    2. Creating stored procedures
      11m 23s
    3. Introducing transactions
      4m 23s
    4. Creating transactions
      8m 37s
  11. 16m 39s
    1. Understanding and creating indexes
      6m 32s
    2. Monitoring and rebuilding indexes
      6m 0s
    3. Monitoring database size and integrity
      4m 7s
  12. 11m 41s
    1. Creating backups
      4m 21s
    2. Creating differential backups and using backup compression
      3m 40s
    3. Restoring databases
      3m 40s
  13. 17m 40s
    1. Introduction to SQL Server security and permissions
      5m 54s
    2. Adding a Windows user to the database
      5m 7s
    3. Creating SQL Server logins and switching authentication modes
      6m 39s
  14. 36m 41s
    1. Introduction to SQL Server Reporting Services
      2m 52s
    2. Connecting to the Report Manager
      4m 29s
    3. Using Report Builder
      12m 4s
    4. Formatting values in reports
      4m 17s
    5. Adding indicators to reports
      5m 11s
    6. Adding charts to reports
      3m 54s
    7. Working with report security
      3m 54s
  15. 24m 41s
    1. Introduction to SQL Server Integration Services (SSIS)
      1m 57s
    2. Using Business Intelligence Development Studio (BIDS)
      6m 59s
    3. Creating and executing a simple SSIS package
      7m 35s
    4. Importing packages into SQL Server Management Studio
      3m 21s
    5. Scheduling jobs with SQL Server Agent
      4m 49s
  16. 31s
    1. Goodbye
      31s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed SQL Server 2008 Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.