SQL Server Authentication to Windows Authentication for single user - sql-server

Is it somehow possible to change the security setting for a single (already existing) user from SQL Server Authentication to Windows Authentication?
The security setting on server-level is set to mixed mode (so both SQL Server Authentication and Windows authentication). For a new login I can choose which authentication mode to set.
But for an existing user (a login that is, created with SQL Server Authentication) the radio-buttons are greyed out. I would like to change this for a number of users without having to recreate these users, but I can't seem to find how this can be done.
Any help would be greatly appreciated.

Related

Attempting to use an NT account name with SQL Server authentication

The authentication mode is "Mixed" for my SQL Server 2016.
I'm using SSMS to run cross-server queries.
I've checked the user account & have ensured that the account has proper authority. I can use a different account and run cross-server queries as expected. The account has proper authority to the databases in question and it has authority to them. I've tried everything I've seen on the internet searches I've done and no luck. The account can login using SSMS.
My linked server properties are:
The account's login properties are:
Has anyone else seen this & have a resolution?
** EDIT: rebooting the target server fixed the issue
When creating a linked server you choose the authentication mechanism by which the remote connection will be made. If you select the fourth option (pictured), the remote login must be a Sql Server authenticated login. It cannot be a windows login.
The only way to connect through a linked server using windows authentication is to forward the credentials of the login on the local server. There is no option to specify a windows username and password.
Indeed, there is no way, ever, to specify a password when connecting to a Sql Server with windows credentials, since the whole point of windows credentials is that you're already authenticated. That happened when you logged in to windows in the morning*
You can only (and must always) specify a password if you are using Sql Server authentication.
What seems to be going on in your case is that the linked server may have been created with the wrong security options. This is just easier to explain with an image:
* More precisely, a connection will be made using the account that the client is running under. If you start SSMS using a "runas /user ..." command, then the windows credentials used to connect to servers will be the credentials specified in runas

Restrict windows authentication to access a SQL Server database

My SQL Server is operating in mixed mode, and I am accessing all my databases with Windows authentication, but I want to restrict one of my database to be accessed by Windows authentication and it should be accessed by SQL Server login user.
I have created a new user and then assign him the rights to access database
from security tab. But this database is also accessible from Windows authentication.
You have to go to DB properties and then flag the security options in the authorization tab.
So, first of all, right click on db name and go to properties. It will pop-up another window with the authorizations tab. Here you can select every single user and decide to grant or not access/modifying ecc...

I need to connect my web application to sql server using windows authentication with a different user

I have a web application (on IIS 7.0) developed with ASP.NET MVC 4. The application manages a database on a SQL Server 2008 R2. Only Windows Authentication is enabled on the site. In my intranet, the domain users access the program without authentication requests. web.config sets a connection string on the site that uses a sql user. All operations on the database are done by this last user. The application should access the database with a windows user instead of a sql user. For this, I created a windows user “MyUser” on Sql Server. I thought I could set a new “connection string” with windows authentication but I wasn't able to pass the credential of “MyUser”. When I set windows authentication on the connection string it uses the client user, and I don't want this.
How I can operate on the database with a different user? I would like all operations on database to be performed by a single windows user (MyUser).
You can give "MyUser" privileges over the folder where your app is. Then you can create an application pool and set the identity to "MyUser" (read this) and assign your app to this application pool.
Your application will be executing with "MyUser" account thus login into SQL with its credentials.
Hope it helps.

Logins created in SQL Server Management Studio are not able to log in

I've been working to try and connect an ASP.NET application to an IIS Site running in an App Pool using Integrated Security. I was eventually unsuccessful in that attempt until I made the Login I'd created to represent the App Pool a Sysadmin, which I understand is not a good thing to leave in there. It's on localhost, but it still makes me uneasy.
So I decided to try to use a Login/Password combo instead of Integrated Security. To that end, I created a new Login in my SQL Server Management Studio:
And told it to use a password, making sure that I know what the password and username are.
My Default database is master
Server Roles is only 'public'
In User Mapping I added db_owner to one of my databases, and all the others are only 'public'
In Securables, 'Connect SQL' is Granted to the SQLEXPRESS server
I then disconnected from SSMS and tried to reconnect using my newly-created Login.
It didn't allow me to log in:
According to:
https://learn.microsoft.com/en-us/sql/relational-databases/security/authentication-access/create-a-login
After creating a login, the login can connect to SQL Server, but does not necessarily have sufficient permission to perform any useful work.
However, that appears to not be the case in this instance. What am I doing wrong?
I did make sure that my Server Authentication was set correctly, per SQL Server 2008 can't login with newly created user
Another data point: when I try (and fail) to log in 10 times in rapid succession and then go back in with Windows authentication, the 'Login is locked out' notification in the Status tab is not checked.
The thing I was missing was going to Windows Services, and restarting SQLEXPRESS to get the change to 'SQL Server and Windows Authentication Mode' to take effect.
After I did that, I was able to log in with my testuser.

Creating a SQL Login for Windows user

I have a .Net application that connects to a SQL Server over the network. The user logs in as the Windows user. The SQL Server is set up as Windows Authentication only. From the client machine, the user is not created on the SQL Server as a login yet. On the first startup of the application, the application needs to check if the windows user is a sql server login and if not, the login must be created by the .net application.
My question is with which user do I log in to the SQL Server to check if the login exists. Obviously it cannot be the current windows user, as this user must be created first and on first run does not exist on sql server.
I already know how to proceed once a connection is established, and need help on the correct login to use when the windows user does not exist as a login on SQL server. Keep in mind that the server is set up for Windows Authentication only.
All of this must be done through .net code (vb or c#).
Thanks for the help.
I do not fully understand your question, but answering it upon what I think you are asking:
You need to be logged in as the Administrator in Windows since you are using Windows Authentication Only.
Once you have logged in as Admin, Windows will recognise that and give you all the authentication rights so when you go into your SQL server these rights will automatically be passed on, allowing your to create new user permissions and grant access etc...
Let me know if this answers your question correctly.

Resources