Search code examples
iiscontinuous-integrationssmssql-server-expresswindows-server-2012

How to add a new SQL Server machine account


I've been following this guide on deploying an ASP.NET web application with CI. It has all been going smoothly till I got to the Configure Logins and Database Permissions stage. Particularly when entering the login name. http://www.asp.net/web-forms/overview/deployment/configuring-server-environments-for-web-deployment/configuring-a-database-server-for-web-deploy-publishing enter image description here For the life of me I cannot discover what must go in this field

The author supplies the following instruction

Machine accounts take the form [domain name][machine name]$ —for example, FABRIKAM\TESTWEB1$.

Despite scouring the internet I have found very little in regard to discovering the domain name and machine name values to be inserted here. Almost everything I enter results in


Create failed for Login 'HISSAP\matt$'. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=13.0.15600.2+((SSMS_Rel).160712-1724)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Login&LinkId=20476


An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)


Windows NT user or group 'HIAP\matt$' not found. Check the name again. (Microsoft SQL Server, Error: 15401)


Now I know that 'matt' is a user account entered above and not a machine account, but I am at a loss in determining what needs to go into the Login Name for the machine account described above in the tutorial. When I use "Search" next to the field I have many options to select many different accounts, but how am I to know which one to select? The tutorial does not specify.

Could I just use a user account for the machine account? If so which one? If not what should I enter as the machine name?

I think the domain name is HIAP, I tried the computer name for the machine name which is also hiap, I tried different cases, with and without the $ at the end. I also went into IIS and tried the host name in site bindings which is hiapdev. Did not work.

I am remotely connecting to a Windows Server 2012 R2.


Solution

  • Don't try the Search... button in General tab to search machine account. Machine account cannot be searched in Select User or Group dialog box. Please follow below mentioned steps to add a machine account to a SQL Server instance:

    1. Open a new login window.
    2. Click General page in the left navigation pane.
    3. Give input in the Login name field in the format [domainName]\[MachineName]$. In your case it is FABRIKAM\TESTWEB1$

    enter image description here

    1. Now go to Server Roles page. Check sysadmin server role as shown below:

    enter image description here

    Press OK. Now, you can see your machine's account under Security > Logins node.

    Credits: Garth Jones