SpnManager Kerberos SPN auditing and repair for Active Directory

Invoke-SpnExecutionEngine

The Invoke-SpnExecutionEngine cmdlet provides a way to automate the registration or removal of Service Principal Names (SPNs) for a given SpnPlan object. T...

The Invoke-SpnExecutionEngine cmdlet provides a way to automate the registration or removal of Service Principal Names (SPNs) for a given SpnPlan object. This can be useful in various scenarios such as: * Automating SPN updates for large-scale deployments * Ensuring consistent SPN configuration across environments * Simplifying testing and validation of SPN changes

Key stakeholders who may use this cmdlet include: * System administrators responsible for service registration and management * Security teams tasked with ensuring accurate and up-to-date SPN configurations

Risks associated with incorrect or incomplete SPN configurations can include: * Authentication failures due to mismatched SPNs * Unauthorized access to services due to missing or duplicate SPNs * Inability to scale services due to inconsistent SPN configurations

A manager may care about this cmdlet when: * Services are experiencing authentication issues * There is a need to automate repetitive SPN updates * Security audits reveal inconsistencies in SPN configurations

Day-to-Day Use

To use the Invoke-SpnExecutionEngine cmdlet, follow these steps:

  1. Import the SpnManager module using Import-Module SpnManager
  2. Create a new SpnPlan object containing the proposed SPNs to be registered or removed
  3. Pass the SpnPlan object to the Invoke-SpnExecutionEngine cmdlet, specifying any desired parameters (e.g., -WhatIf, -Add, -Remove)
  4. Optional: use the -PassthroughResults parameter to route output directly to a file or other destination

Example code:

$spnPlan = New-SpnPlan -Name "MyService" -ProposedSpns @("service/my-service/hostname")
Invoke-SpnExecutionEngine -Plan $spnPlan -WhatIf

Common Patterns and Code Examples

  • Use the -Add parameter to register new SPNs
  • Use the -Remove parameter to remove existing SPNs
  • Combine multiple SpnPlans into a single object for batch execution

Watchpoints: * Ensure that the setspn.exe executable is installed and available on the target system * Be cautious when using the -PassthroughResults parameter, as it can introduce additional complexity and security considerations

What It Does in Simple Terms

The Invoke-SpnExecutionEngine cmdlet helps automate the registration or removal of Service Principal Names (SPNs) for a service. SPNs are like ” nicknames” for services that help identify them during authentication.

Here’s a step-by-step recipe:

  1. Create a new SpnPlan object with the proposed SPNs
  2. Pass the SpnPlan object to the Invoke-SpnExecutionEngine cmdlet
  3. Specify any desired parameters (e.g., -WhatIf, -Add, -Remove)
  4. The cmdlet will execute the necessary setspn.exe commands

Simple Recipes and Troubleshooting Tips

  • Use the -WhatIf parameter to test SPN updates without making changes
  • Check the output of the cmdlet for any errors or warnings
  • Consult the SpnManager documentation and community resources if you get stuck
Field Value
Vendor Detent Point LLC
Product SpnManager 0.4.0
Licence Proprietary - licensed, not sold. See LICENSE.
Operational impact CHANGES directory state. Registers or removes Service Principal Names on Active Directory accounts.
Rights required Write access to the target account’s servicePrincipalName attribute.
Providers covered SQL.SSAS, SQL.SSRS, AD.IIS, AD.ADFS, AD.SharePoint
Approval recommendation Approve for use by directory administrators, through change control. Preview with -WhatIf before any scheduled use.

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.
Rights to write servicePrincipalName Only for the write path. Audit and hand-off operations do not need it.

Data Handling

  • The Invoke-SpnExecutionEngine cmdlet does not handle sensitive data; it focuses on executing external commands to manage SPNs.
  • However, when using the -PassthroughResults parameter, ensure that output is properly secured and handled in compliance with organizational security policies.

Transit and At-Rest

  • SPN registrations and removals are executed on the target system using setspn.exe.
  • No data is stored or transmitted by the cmdlet itself; all actions are performed through external commands.

Audit Trail

The cmdlet generates output that can be used to track changes made to SPNs. However, it is essential to maintain a centralized audit trail for compliance and monitoring purposes.

Compliance Requirements

  • Adhere to organizational security policies for handling sensitive data.
  • Use the cmdlet in conjunction with existing security controls and audit trails to ensure accurate tracking of SPN updates.

This is the execute step. It is the point at which Active Directory is changed. Providers: AD.ADFS, AD.IIS, AD.SharePoint, SQL.SSAS, SQL.SSRS.

This command changes Active Directory. Run it with -WhatIf first to see exactly which SPNs would be registered or removed.

Example 1

$plan | Invoke-SpnExecutionEngine -Mode Add

Registers all ProposedSpns in the plan using setspn -S.

Example 2

$plan | Invoke-SpnExecutionEngine -Mode Remove -WhatIf

Shows what setspn commands would run without executing them.

Example 3

$plan | Invoke-SpnExecutionEngine -Mode $mode -PassThru