dsccommunity / dsccommunity/SqlServerDsc

SqlProtocol: Cannot restart an instance where the protocol was enabled from previously been disabled

Open
#1,174 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
PowerShell
Stars
385
Forks
224
PR merge metrics
No merged PRs in 30d

Description

Details of the scenario you tried and the problem that is occurring

When there is a clustered instance and the protocol is disabled but manual intervention (and the instance was restarted) and the desired state is to have the protocol enable, there is no way to restart the instance when the protocol is enabled by the configuration. This is because the Restart-SqlService helper function connects to the instance to evaluate the property IsClustered to determine if it is a clustered instance.

https://github.com/PowerShell/SqlServerDsc/blob/9b6f76804acf1cf241afb8161f85e8a113ecf280/SqlServerDscHelper.psm1#L819-L821

There is no way in the current implementation to restart a instance where the protocol was enabled from previously been disabled. An issue should be started to track this.

The DSC configuration that is using the resource (as detailed as possible)
Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [System.Management.Automation.PSCredential]
        $SystemAdministratorAccount
    )

    Import-DscResource -ModuleName SqlServerDsc

    node localhost
    {
        SqlServerProtocol 'EnableTcpIp'
        {
            InstanceName         = 'CLUINSTANCE'
            ProtocolName         = 'TcpIp'
            Enabled              = $true

            PsDscRunAsCredential = $SystemAdministratorAccount
        }
    }
}
Version of the operating system and PowerShell the target node is running

Any supported

SQL Server edition and version the target node is running

Any supported

What SQL Server PowerShell modules, and which version, are present on the target node.

Any

Version of the DSC module you're using, or write 'dev' if you're using current dev branch

Dev

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Restart-SqlService in SqlServerDscHelper.psm1 at the linked lines, then trace how the SqlServerProtocol resource enables TcpIp on a clustered instance. Confirm the failure when the protocol was previously disabled and the instance was restarted; done means the configured enablement can restart the instance without requiring a connection that is unavailable during the transition.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, sql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.