SQL Server is where this work started. Test-SqlSpnPlan 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.
As a manager, you care about the business value of validating a plan object’s shape before execution. This is crucial for preventing costly errors and ensuring that your organization’s sensitive information is handled correctly.
- Business value: Validates plan object’s structure to prevent errors and data loss.
- Who uses this:
- IT administrators responsible for setting up and managing SQL Server instances.
- Developers working on applications that interact with SQL Server.
- System administrators tasked with maintaining the security and integrity of the system.
- Risks:
- Incorrectly structured plan objects can lead to data corruption, loss, or security breaches.
- Failing to validate the plan object’s shape can result in unexpected behavior or errors during execution.
- When a manager cares: When planning and executing changes to SQL Server instances that involve setting up or modifying service principal names (SPNs).
To use Test-SqlSpnPlan, follow these steps:
- Import the SpnManager module using
Import-Module. - Create a plan object with the required fields: AccountDn, ProposedSpns, and Role.
- Call
Test-SqlSpnPlanwith the plan object as input.
(plan-object = [PSCustomObject]@{
AccountDn = 'CN=Account,CN=Users,DC=example,DC=com'
ProposedSpns = @('MSSQLSvc/account:1433')
Role = 'SQLSERVERMSSQLSERVICE'
})
$result = Test-SqlSpnPlan -SpnPlan $plan-object- Common patterns:
- Use
Test-SqlSpnPlanas a pre-execution check to ensure the plan object is valid. - Integrate this cmdlet into your automation scripts or workflows for SQL Server setup and maintenance.
- Use
- Watchpoints: Be aware that this cmdlet only performs local validation; it does not account for forest-wide duplicate detection, which should be handled separately.
Test-SqlSpnPlan is a PowerShell cmdlet used to validate the structure of a plan object before execution. Here’s how it works:
- The cmdlet checks if the plan object has the required fields: AccountDn, ProposedSpns, and Role.
- It ensures that the
ProposedSpnsfield contains at least one SPN. - If the plan object is valid, the cmdlet returns
$true. Otherwise, it returns$false.
To use this cmdlet:
- Create a plan object with the required fields.
- Call
Test-SqlSpnPlanwith the plan object as input.
Here’s an example recipe:
- Step 1: Create a new plan object
(plan-object = [PSCustomObject]@{
AccountDn = 'CN=Account,CN=Users,DC=example,DC=com'
ProposedSpns = @('MSSQLSvc/account:1433')
Role = 'SQLSERVERMSSQLSERVICE'
})- Step 2: Validate the plan object using
Test-SqlSpnPlan
$result = Test-SqlSpnPlan -SpnPlan $plan-objectif ($result) { “The plan object is valid.” } else { “The plan object has errors. Please check the output for details.” } * What to do when stuck: + Check that your plan object has the required fields and that ProposedSpns contains at least one SPN. + Verify that you have correctly imported the SpnManager module.
| 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. Some providers additionally need rights to read delegation and encryption-type attributes. |
| Providers covered | SQL.Engine |
| 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. |
Test-SqlSpnPlan handles sensitive information, including service principal names (SPNs). Here’s how we ensure compliance:
- Data-handling: The cmdlet only reads and validates the plan object; it does not modify or write any data.
- Transit: The cmdlet operates locally on the system, without transmitting data over the network.
- At-rest: The plan object is stored in memory during execution; it is not persisted to disk unless explicitly saved.
- Audit trail: We do not maintain an audit trail for this cmdlet. However, we recommend using logging and auditing tools within your organization to track changes made by
Test-SqlSpnPlan(if used in a production environment). - Compliance requirements:
- The organization must adhere to its internal security policies regarding the handling of sensitive information.
- Comply with relevant laws and regulations regarding data protection, such as GDPR or HIPAA.
This is the test step. It checks a plan before anything acts on it. Its output is normally piped into Invoke-SqlSpnExecutionEngine. Providers: SQL.Engine.
Example 1
$plan | Test-SqlSpnPlanExample 2
$result = Test-SqlSpnPlan -SpnPlan $planif ($result.Status -ne ‘Clear’) { throw “Plan invalid: (result.Reason)” }
Example 3
$plan | Test-SqlSpnPlan