Azure SQL Database roles and access - sql-server

What harm can a user with GRANT SELECT ON database.dbo.view TO User access can do? The user can see Security folder in SSMS, roles and can also see master database, roles, etc.? Is there a way we can restrict the user to not see or modify any security roles/groups but can see only a view?
Many Thanks!

In SSMS, a new user will not see the database tables/views without proper roles/permission provided to them but they can see the database objects like Security Users, schema or Roles etc., however they still cannot perform any actions on them if they don't have proper permissions granted to them. As an example if you created a new user and granted a select for a single view, that user will just be able to Select from the view and not able to do anything else on it like altering/deleting the view. Also same user can see the security objects but cannot make any changes on them as well.
We can hide the databases from user in SSMS by using below statement but this is going to hide all the database(even the database in which user has access to see the view).
DENY VIEW ANY DATABASE TO <login name>

Related

SQL Server Management Studio deny view access to all databases but the ones user has access to without making user owner

I'm using SQL Server 2014/2016. Is it possible to deny a user(s) view access to all database but the ones they have access to without making the user owner?
I don't want the user to have owner permissions as well as I'll be adding multiple users to the database.
I've gone through a lot of threads and it doesn't seem like you can but it seems like an obvious feature that people may want so I'm not too sure.
DENY VIEW ANY DATABASE TO userName
ALTER AUTHORIZATION ON DATABASE:: [DbName] TO userName
Regards

Granting Full SQL Server Permissions for a Database

How can I give a user (who was created WITHOUT LOGIN) full control over a contained database without having to specify that database's name, like GRANT CONTROL ON DATABASE::DatabaseName TO UserName, but without using a database name? I figure it'll include GRANT ALTER ANY SCHEMA TO UserName, but I'm not sure what else I'd need to grant, or if there's a better way. Thanks.
If you literally want them to be able to do anything in that database, you can just add them to the db_owner role:
USE ContainedDatabase;
GO
ALTER ROLE db_owner ADD MEMBER [username];
If you want to be more granular, you can add them to lesser roles, like db_ddladmin, db_securityadmin, etc. You can see the list of built-in roles here:
Database-Level Roles
The permissions inherent in each of those roles:
Permissions of Fixed Database Roles
And if those don't suit, you can create your own roles, add your user to that role, and grant specific permissions to that role you created (and/or add them to other roles). The difference between applying the permissions to the role instead of directly to the user is simply reuse - if you add five more users that you want to apply the same permissions, you just add them to the custom role, rather than apply those granular permissions or roles to all 5 of the users.
Open SQL Server Management Studio and connect to your server.
In the Object Explorer, expand the "Security" folder under the server.
Right click on the "Logins" folder and choose "New Login..."
Add the users name in the format "Domain\UserName". You can also add domain groups by just changing it to "Domain\GroupName".
5.If you would like this user to have full access to the SQL Server instance, you can choose the "Server Roles" tab. Adding the role "sysadmin" will give them full access to the server to do actions like update the database, backup the database, delete the database.
Click ok and your user will be created and have access to your database.
Choose the "User Mapping" tab. In the top half of this screen, check the box next to the database name. Once you highlight the database and check the box to map the user to it, you can add role memberships to the user. For access to the database.
Click ok and your user will be created and have access to your database.

Restrict database for only one user

i dont know how to ask my question but still i try. I am using SQLServer2008R2. I have created one database say DB1 and also created one SQLServer user say User1. Now I want that only User1 can have access of DB1 database and other user can not access to DB1.
You should look at the security node in management studio for your database.
Check that your user is the only login that associated with your database.
If you want to prevent that user creating another user, revoke his permissions to create users.
For more information on users and roles, see the documentation http://msdn.microsoft.com/en-us/library/aa337552.aspx

How to give access to a specific database for a Plesk 11 user

So, I've created a user in Plesk 11, and assigned him a role (custom role that a created for him) with only database access.
But this new user has access to all my databases, I want to restrict his access to a specific one.
How can I do this please ?
Thank you.
Unfortunately it's impossible(at least I don't know how) in scope of one subscription(even through direct url), it's possible to just bind this user to one exact subscription and move all other databases in another subscription.
You can add this as feature request to https://plesk.uservoice.com/forums/184549-feature-suggestions
Roles give administrative rights to users so Plesk is doing exactly what it was told to do.
Granting administrative DB permissions however does not create a mysql user but a panel user who can manage the databases of the subscriptions you gave him access to ("all" or individually selected).
If you see all databases in phpMyAdmin you are not logged in as this user but clicked a "webadmin" link from within plesk which uses a login-token for the matching db user created for this subscription/database or even the admin (Tools & Settings-> Applications & Databases -> Database Servers -> Servername -> Databases) -> "Webadmin" in "Tools" section.
If you see all databases of all subscriptions in Plesk Panel you selected "all" in the "access subscriptions" field when creating the user.
Defining a custom role as an approach for giving access to only one database does not make sense as there is no need for administrative rights (he only could delete his database).
If your intention was to create just a mysql user for a specific database in a specific subscription open subscriber's control panel when logged in as admin user, click "databases", select tab "users", click "add new database user" and select which databases this new user should have access to. done.
Unfortunately for me it is not clear
where your user sees all the databases
if "all" really is all of them (like system dbs, too)
if "access" means control panel or mysql/phpmyadmin
However, I hope i covered all contingencies.

SQL Server 2005 Security

Here is the scenario. I have a SQL Server 2005 production database/server. It currently has developers and supporters who can connect to it. I need to create a security module that gives developers read-only access to all areas of the database. This means that a developer should be able to view all objects as well as scheduled activities/jobs only.
Is it possible to enable security in this way and if so can I be gently guided on how to achieve this. I am learning to be a DBA and creating snapshots of the databases are not an option.
Thank you all in advance.
There is permission to every object.
Create a stored procedure that grant each gruop the exact permission you need on the objects you need to protect.
I'm not quite sure I follow where this "security module" will be in the architecture. Anyhow, here's one possibility that secures it from the database end.
I'm going to assume you already have users created.
Create a new role (yourdb > security > roles > new database role), say "ReadOnlyDevelopers". Make the owner dbo or whatever makes sense. Do not select any schemas to be owned by the role. Populate the "Role Members" with your developers.
Next, open the properties page on your database. Go to the permissions page. Click Add... and add the new role. Under the permissions grid at the bottom, Grant SELECT to the role.
Now assuming your developers already belong to some other role, you'll need to go into the user properties and under Database Role Membership restrict them to just the new role. At this point they should be able to just read
I'm guessing that I'm missing a detail or two (the role may need to be grated a few additional rights to "see" the database, alter passwords, etc.) but I can't get to that level of detail without setting up the entire scenario. Hopefully this pushes you in the right direction.

Resources