dsccommunity / dsccommunity/SqlServerDsc

SQLAGDatabase: Non-default port number does not work when Browser service is disabled

Open
#1,189 13 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

Hi,

I'm trying to add an existing database to an existing AG and it's failing with the following error

PowerShell DSC resource MSFT_SqlAGDatabase failed to execute Set-TargetResource functionality with error message: System.InvalidOperationException: Failed to connect to SQL instance 'server2_secondary\instancename'

The connection fails when trying to reach the secondary node and I Imagine this is to do with the fact that we are using a non default port for the our instances.

Even when I use SSMS to add a database to the the AG by default the GUI shows servername\instancename and if I try to connect it fails . I have to click "Options" and then go back to the "Login properties" tab so the instancename gets replaced by the port number ( this is done automatically by the GUID, quite weird) and I can then add the database.

Does anyone have the same problem ? How to solve this ?

Thank you,

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

SQLCheckCLR 1.0
SQLCheckCollation 1.0
SqlServer 21.0.17240
SQLASCMDLETS 1.0
SQLPS 1.0
SQLPS 14.0-->

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 at the MSFT_SqlAGDatabase Set-TargetResource functionality and reproduce the failure when connecting to the secondary instance with a non-default port and SQL Server Browser disabled. Done means adding the database to the existing availability group succeeds without requiring the SSMS connection workaround.

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
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.