SQL Server is where this work started. Get-SqlSpnAccount ships in SqlSpnManager, on the PowerShell Gallery now — Install-Module SqlSpnManager. You can run it today.
SPN Manager takes the same approach across the rest of the directory, 26 service families in all. How the two products relate long term is not settled, and the free edition’s scope may narrow toward auditing in a future release. Any version you install stays yours — the Gallery keeps published versions available.
Business value: The Get-SqlSpnAccount cmdlet is used to verify the existence of a standard Active Directory account and retrieve its normalized descriptor. This is the first step in the SPN management pipeline, ensuring that downstream functions can operate correctly.
- Business stakeholders use this cmdlet when provisioning or managing SQL Server services that rely on Active Directory service accounts.
- Risks associated with incorrect or missing service accounts include:
- Failed service deployment
- Data corruption due to improper authorization
- Security vulnerabilities resulting from weak passwords or misconfigured permissions
- A manager cares about this cmdlet when:
- Ensuring compliance with security and access control policies
- Troubleshooting failed SQL Server deployments
Day-to-day use
To use Get-SqlSpnAccount, follow these steps:
- Install the SpnManager module using PowerShell.
- Import the SpnManager module in your PowerShell session:
Import-Module -Name SpnManager - Run the cmdlet with the required account name or gMSA, for example:
Get-SqlSpnAccount -ServiceAccount 'SQLSvcAcct'
Code examples:
# Retrieving a standard Active Directory service account
$account = Get-SqlSpnAccount -SamAccountName 'svc_sql_prod'
# Feeding the verified account to the plan builder
New-SqlSpnPlan -VerifiedAccount $account -Infrastructure $infra -Role EngineWatchpoints:
- Ensure you have the necessary permissions to access Active Directory.
- Verify that the input account name or gMSA exists in your environment.
What does Get-SqlSpnAccount do?
This cmdlet ensures a standard Active Directory service account exists and retrieves its normalized descriptor. You can use this descriptor with downstream functions, such as New-SqlSpnPlan or Invoke-SqlSpnExecutionEngine.
Step-by-step recipe
- Install the SpnManager module.
- Import the SpnManager module in your PowerShell session.
- Run
Get-SqlSpnAccountwith the required account name or gMSA.
If you get stuck:
- Check that the input account name or gMSA exists in Active Directory.
- Verify that you have the necessary permissions to access Active Directory.
| Field | Value |
|---|---|
| Vendor | Detent Point LLC |
| Product | SpnManager 0.4.0 |
| Licence | Proprietary - licensed, not sold. See LICENSE. |
| Operational impact | Read-only. Queries Active Directory and reports findings; changes nothing. |
| Rights required | Directory read access. |
| Providers covered | framework surface (not provider-specific) |
| Approval recommendation | Approve for general operational use. It cannot alter directory state. |
Licence terms are proprietary and are supplied with the purchase, subscription or evaluation agreement. No open-source licence is granted.
| What | Why |
|---|---|
| Windows PowerShell 5.1 or later | Declared by the module manifest. |
| ActiveDirectory 1.0.0.0 | Required module. Ships with RSAT; install the Active Directory PowerShell feature. |
| A reachable domain controller | Every provider reads from Active Directory. |
| An account with directory read access | Needed to enumerate accounts and their SPNs. |
Data handling: The cmdlet ensures that the input account name or gMSA exists in Active Directory before proceeding.
Transit: Data is stored in memory while processing.
At rest: No sensitive data is stored persistently by this cmdlet.
Audit trail: A non-terminating error is emitted on lookup failure, allowing callers to decide whether to abort the pipeline or recover.
Compliance requirements:
- Ensure that Active Directory service accounts are properly configured and managed.
- Verify that necessary permissions are granted for accessing Active Directory.
Example 1
Get-SqlSpnAccount -SamAccountName 'svc_sql_prod'Example 2
$acct = Get-SqlSpnAccount -SamAccountName 'SQLFCI01$'if ($acct.ObjectClass -eq ‘computer’) { ‘OK for FCI Engine SPN’ }
Example 3
$account = Get-SqlSpnAccount -SamAccountName 'svc_sql'
$account.DistinguishedName