commands

^

Test-DbaAgSpn

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Test-DbaAgSpn on GitHub.
Want to see the Bill Of Health for this command? Check out Test-DbaAgSpn.

Synopsis

Tests the SPNs for an availability group listener

Description

Tests the SPNs for an availability group listener

https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/listeners-client-connectivity-application-failover?view=sql-server-ver16#SPNs was used as a guide

Syntax

Test-DbaAgSpn
    [[-SqlInstance] <DbaInstanceParameter[]>]
    [[-SqlCredential] <PSCredential>]
    [[-Credential] <PSCredential>]
    [[-AvailabilityGroup] <String[]>]
    [[-Listener] <String[]>]
    [[-InputObject] <AvailabilityGroup[]>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaAvailabilityGroup -SqlInstance sql01 -AvailabilityGroup SharePoint | Test-DbaAgSpn

Tests the SPNs for the SharePoint availability group listeners on sql01

Example: 2
PS C:\> Test-DbaAgSpn -SqlInstance sql01 -AvailabilityGroup SharePoint -Listener spag01

Tests the spag01 SPN for the SharePoint availability group listener on sql01

Example: 3
PS C:\> Test-DbaAgSpn -SqlInstance sql01 | Set-DbaSpn

Tests the SPNs for all availability group listeners on sql01 and sets them if they are not set

Optional Parameters

-SqlInstance

The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.

Alias
Required False
Pipeline false
Default Value
-SqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.

Alias
Required False
Pipeline false
Default Value
-Credential

Alternative credential for connecting to Active Directory.

Alias
Required False
Pipeline false
Default Value
-AvailabilityGroup

The availability group to test. If not specified, all availability groups will be tested.

Alias
Required False
Pipeline false
Default Value
-Listener

The availability group listener to test. If not specified, all listeners will be tested.

Alias
Required False
Pipeline false
Default Value
-InputObject

Enables piped input from Get-DbaAvailabilityGroup.

Alias
Required False
Pipeline true (ByValue)
Default Value
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False