a·gen·tic a·gil·i·ty

Connecting to SQL Server using DNS

TL;DR; Explains how to enable Windows Authentication for SQL Server connections via DNS by configuring the SQL Server Browser service and setting up Service Principal Names (SPNs).

Published on
2 minute read
Image
https://nkdagility.com/resources/tV0-x7E8IQc
Subscribe

If you want to connect to a SQL server using DNS you will need to have both the “SQL Server Browser” service and an SPN setup in your domain to allow authentication.

This allows the DNS name that you have setup to authenticate against the SQL Server using integrated authentication.

setspn MSSQLSvc/spdata.ep-dev.[domain].biz:1422 [servername]
setspn MSSQLSvc/spdata.ep-dev.[domain].biz:1433 [servername]

You will know that you need to do this if all of the below is true:

  1. Pining your domain brings back the correct IP of the server
  2. You can connect to the SQL Server using the server name with Windows Authentication.
  3. You can connect to the SQL server using the IP address with Windows Authentication.
  4. You can NOT connect to the SQL server using the spdata.ep-dev.[domain].biz with Windows Authentication.
  5. You can connect to the SQL server using the spdata.ep-dev.[domain].biz with SQL Server Authentication.

Connecting to SQL Server using DNS Connecting to SQL Server using DNS   Connecting to SQL Server using DNS   Connecting to SQL Server using DNS

Connecting to SQL Server using DNS

You can get he setspn tool from the Windows Server 2003 Admin Pack.

Use it to see what SPN’s already exist and to see how you can utilise them. For example calling setspn on my [servername] produced:

C:>setspn [servername]
Registered ServicePrincipalNames for CN=[servername],OU=Member Servers,DC=[domain],DC=biz:
    MSSQLSvc/[servername].[domain].biz:1422
    MSSQLSvc/[servername].[domain].biz:1433
    SMTPSVC/[servername]
    SMTPSVC/[servername].[domain].biz
    HOST/[servername].[domain]onet.biz
    HOST/[servername]

this information helped me identify that the first two “MSSQLSvc” spn’s would need to be added to this server. You can add SPN’s to accounts as well, but if you only need to access a single server then adding it to an account is a little overkill and probably a security risk.

I’m off to make a request for infrastructure to run this… Connecting to SQL Server using DNS

Technorati Tags: SP 2007

Smart Classifications

Each classification [Concepts, Categories, & Tags] was assigned using AI-powered semantic analysis and scored across relevance, depth, and alignment. Final decisions? Still human. Always traceable. Hover to see how it applies.

Subscribe

Connect with Martin Hinshelwood

If you've made it this far, it's worth connecting with our principal consultant and coach, Martin Hinshelwood, for a 30-minute 'ask me anything' call.

Our Happy Clients​

We partner with businesses across diverse industries, including finance, insurance, healthcare, pharmaceuticals, technology, engineering, transportation, hospitality, entertainment, legal, government, and military sectors.​

Epic Games Logo

Epic Games

Milliman Logo

Milliman

Brandes Investment Partners L.P. Logo

Brandes Investment Partners L.P.

Genus Breeding Ltd Logo

Genus Breeding Ltd

Flowmaster (a Mentor Graphics Company) Logo

Flowmaster (a Mentor Graphics Company)

Higher Education Statistics Agency Logo

Higher Education Statistics Agency

Healthgrades Logo

Healthgrades

Xceptor - Process and Data Automation Logo

Xceptor - Process and Data Automation

Big Data for Humans Logo

Big Data for Humans

Hubtel Ghana Logo

Hubtel Ghana

Lockheed Martin Logo

Lockheed Martin

ALS Life Sciences Logo

ALS Life Sciences

New Signature Logo

New Signature

Jack Links Logo

Jack Links

Graham & Brown Logo

Graham & Brown

Trayport Logo

Trayport

MacDonald Humfrey (Automation) Ltd. Logo

MacDonald Humfrey (Automation) Ltd.

Bistech Logo

Bistech

Ghana Police Service Logo

Ghana Police Service

New Hampshire Supreme Court Logo

New Hampshire Supreme Court

Department of Work and Pensions (UK) Logo

Department of Work and Pensions (UK)

Washington Department of Enterprise Services Logo

Washington Department of Enterprise Services

Washington Department of Transport Logo

Washington Department of Transport

Nottingham County Council Logo

Nottingham County Council

Kongsberg Maritime Logo

Kongsberg Maritime

NIT A/S

Bistech Logo

Bistech

ProgramUtvikling Logo

ProgramUtvikling

Qualco Logo

Qualco

Microsoft Logo

Microsoft