Paras Doshi – Blog

Menu

Skip to content
  • Blog Home
  • Archives
  • About Paras
  • Contact Paras

Tag Archives: Master

How to create users with limited access in SQL Azure?

Posted on November 4, 2011 by Paras Doshi • Posted in #sqlazure, SQL, SQL Azure, SQL-Azure, SQLAzure • Tagged Database, Login, Master, Microsoft, Microsoft SQL Server, Server (computing), sql, sql azure • 1 Comment

In this blog post, we will see how to mange the SQL Azure login and learn how to create users with limited access in SQL Azure.

Now, To create a user, we need to have a login. And we create a login by logging into Master database with server-level principal login or user with loginmanager role.

So now i log into Master database  of one of my SQL Azure server with server level principal login. And I run the following query to create a login named ‘parasdoshicom’:

create login parasdoshicom with password=’Passw0rd’

go

SQL Azure Login pic1

Quick note: choose a strong password – otherwise you may get an error. Strong passwords are those that has 8 character long with combination of symbols, numbers and letters. So i have ‘zero – 0′ in my password.

Now, we want to create a user in a user-database that has limited access. To do so, first login to that database. In my case, I want to create an user in the ‘adventureworksltaz2008r2’ and give him just the db_datareader role. let’s see how we do that.

So first I login to ‘adventureworksltaz2008r2’ with server-level principal login. And then:

1. run the command to create a user (let’s name it parasdoshicom which is same as the login name in this case) from the login parasdoshicom

create user parasdoshicom from login parasdoshicom

go

SQL Azure Login pic2

2. Assign the db_datareader role to user ‘parasdoshicom’

EXEC sp_addrolemember N’db_datareader’,N’parasdoshicom’

go

SQL Azure Login pic3

Now to test what we have just done. I am going to login to the “adventureworksltaz2008r2” database with parasdoshicom user credentials.

1. And I am going to run a select query <- This should work

2. And I am going to run a delete query <- This should not work

Let’s see:

1. select query with new login “parasdoshicom”

SQL Azure Login pic4

As expected, it runs!

2. Now let’s try running a delete command:

SQL Azure Login pic5

And it did not work. Notice that permission was denied. And that is what we intended, right?

So we were successful at creating a user “parasdoshicom” that can only read data from the “adventureworksltaz2008r2” database. And thus we have limited the access for the user in SQL Azure.

Related articles
  • Quick summary of Ideas that I have logged at My Great Windows Azure Idea site (parasdoshi.com)
  • Top two ways you can screw up the established SQL Azure connection from SSMS 2008 R2 running locally (parasdoshi.com)
  • part 5 of “Getting started with SQL Azure” is live! (parasdoshi.com)
32.985909 -96.755436

Rate this:

Was this helpful? Share it!

  • Pin It
  • More
  • DZone
  • Digg
  • Share on Tumblr
  • Print
  • Email

Like this:

Like Loading...

Post navigation

Search on ParasDoshi.com:

About this Blog:

Information is the NEW oil and Blogging is one mechanism to share Information. In this blog, Paras share's information about amazing technologies that he get to work with!

MCC award recipient

Paras Doshi Microsoft Community contributor 2011 MCC

Featured on Wordpress’s Freshly Pressed

Paras Doshi Blog Freshly Pressed Wordpress

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 805 other followers

Subscribe Via RSS

  • RSS - Posts
  • RSS - Comments

Let’s connect and converse on any of these people networks:

paras doshi blog on facebookparas doshi twitter paras doshi google plus paras doshi linkedin

Top Posts & Pages:

  • How to disable the password expiration policy in Windows Server 2008 R2 (Demo Machine) ?
  • 10 Beginner Level Windows Azure Interview Question and Answers (Q&A)
  • [SSIS] unzip a file in SQL server Integration services (SSIS) package
  • "An unexpected system error occured..." - While trying to establish a Data Connection in Performance Point 2010 Dashboard Designer
  • Examples to help clarify what's unstructured data and what's structured?

Recent Posts:

  • Data Analysis and In Memory Technologies, let’s connect the dots:
  • The role of Sentiment Analysis in Social Media Monitoring:
  • How conditionally formatting your data in Excel can help you save time in answering business questions?
  • Resource: Introduction to Data Science by Prof Bill Howe, UW
  • Unpivoting data using the data explorer preview for Excel 2010/2013:

Books

List of Books i have read in no particular order

Tags

Apache Hadoop azure BigData Big Data Business Business intelligence Cloud computing Data Data analysis Database Databases Data mining Data quality Data Quality Services Data set Data Warehousing DQS Excel Facebook Google Hadoop Knowledge base Machine learning MapReduce Master data management Microsoft Microsoft Excel Microsoft SharePoint Microsoft SQL Server Microsoft Windows Powerpivot Programming Social media Spreadsheet Spreadsheets sql sql azure sqlazure sql server SQL Server Integration Services SQL Server Management Studio Technology Twitter United States windows azure

Shout out to community members who liked/comented one or more blog-post, Thanks!

Connect with me on Facebook Page:

Connect with me on Twitter:

  • Nice Playlist on Ted: "making sense of too much data" bit.ly/Y3VVLK 23 hours ago
  • RT @lynnlangit: re-posting due to requests 'Life Behind GLASS' - my review includes unedited video and photos taken with GLASS #io13 http:/… 4 days ago
  • BBC Documentary: Joy of Stats featuring Hans Rosling: bit.ly/rEQVyF bit.ly/rEQVyF 1 week ago
Follow @Paras_Doshi

Disclaimer:

These are my personal views and are meant for Informational purpose only. Please verify the Information via Professional help or via Official references before acting upon the information provided in this Blog.

Here's the Creative Commons License:

Creative Commons License
ParasDoshi.com by Paras Doshi is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Based on a work at parasdoshi.com.
Permissions beyond the scope of this license may be available at http://parasdoshi.com/contact/.

Thanks,
Paras Doshi

Blog at WordPress.com. Theme: Skylark by Blank Themes.
Follow

Get every new post delivered to your Inbox.

Join 805 other followers

Powered by WordPress.com
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.
%d bloggers like this: