Hi,
I'm currently building some SQL Server 2014 Enterprise VM's in Azure (using powershell) using the latest SQL server image available. My issue is that when the VM isn't joined to a Windows domain I am able to connect to SQL server through SSMS (using the local Windows account), however as soon as I join the VM to the Windows domain I am unable to connect to it due to security. If I try and use the previous credentials these also fail.
SQL is configured for Windows authentication only.
My question is, how do I configure SQL server to grant permissions to Windows accounts so that I can access SQL straight away?
I've tried executing the commands below, but they fail.
PS C:\Scripts> Invoke-SqlCmd -Query "CREATE LOGIN [marcus] FROM WINDOWS" -ServerInstance localhost Invoke-SqlCmd : Login failed for user 'DOMAIN\Marcus'. At line:1 char:1+ Invoke-SqlCmd -Query "CREATE LOGIN [marcus] FROM WINDOWS" -ServerInst ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlException+ FullyQualifiedErrorId : SqlExectionError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand Invoke-SqlCmd : At line:1 char:1 + Invoke-SqlCmd -Query "CREATE LOGIN [marcus] FROM WINDOWS" -ServerInst ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : ParserError: (:) [Invoke-Sqlcmd], ParserException+ FullyQualifiedErrorId : ExecutionFailureException,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand PS SQLSERVER:\>
Checking the SQL error log shows the following:
2014-10-28 11:32:41.72 Logon Error: 18456, Severity: 14, State: 5.
2014-10-28 11:32:41.72 Logon Login failed for user 'DOMAIN\Marcus'. Reason: Could not find a login matching the name provided. [CLIENT: <local machine>]
Can anyone point me in the right direction? SQL Server isn't my speciality.
Marcus