Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error occurred while attempting to access availability replica when specifying only node name #1034

Closed
shurick81 opened this issue Jan 25, 2018 · 3 comments · Fixed by #1035
Assignees
Labels
enhancement The issue is an enhancement request.

Comments

@shurick81
Copy link
Contributor

Details of the scenario you tried and the problem that is occurring:
Just trying to build an availability group.
When I create a replica, I have to specify name in 'server\instance` format. Otherwise I get the following error:

VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Preferred module SqlServer found.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Importing PowerShell module SqlServer.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Connected to SQL instance
'FKV04SPDB\SPIntra01'.
VERBOSE: [FKV04SPDB]: LCM:  [ End    Test     ]  [[SqlAGReplica]SecondReplica]  in 0.6550 seconds.
VERBOSE: [FKV04SPDB]: LCM:  [ Start  Set      ]  [[SqlAGReplica]SecondReplica]
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Preferred module SqlServer found.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Importing PowerShell module SqlServer.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Preferred module SqlServer found.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Importing PowerShell module SqlServer.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Connected to SQL instance
'FKV04SPDB\SPIntra01'.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Getting the effective permissions for
the login 'NT SERVICE\ClusSvc' on 'SPINTRA01'.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Preferred module SqlServer found.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Importing PowerShell module SqlServer.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Connected to SQL instance
'FKV04SPDB\SPINTRA01'.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] The cluster login 'NT SERVICE\ClusSvc'
has the required permissions.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Preferred module SqlServer found.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Importing PowerShell module SqlServer.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] Connected to SQL instance
'fkv03spdb\SPIntra01'.
VERBOSE: [FKV04SPDB]:                            [[SqlAGReplica]SecondReplica] ALTER AVAILABILITY GROUP [AG01] JOIN;
VERBOSE: [FKV04SPDB]: LCM:  [ End    Set      ]  [[SqlAGReplica]SecondReplica]  in 1.5420 seconds.
PowerShell DSC resource MSFT_SqlAGReplica  failed to execute Set-TargetResource functionality with error message:
Failed to join the availability group replica 'FKV04SPDB'. InnerException: An error occurred while attempting to
access availability replica 'FKV04SPDB\SPINTRA01' in availability group 'AG01'.  The availability replica is not found
in the availability group configuration.  Verify that the availability group and availability replica names are
correct, then retry the command.
Failed to join local availability replica to availability group 'AG01'.  The operation encountered SQL Server error
41167 and has been rolled back.  Check the SQL Server error log for more details.  When the cause of the error has
been resolved, retry the ALTER AVAILABILITY GROUP JOIN command.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : fkv04spdb

VERBOSE: [FKV04SPDB]: LCM:  [ End    Set      ]
The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : fkv04spdb

It might be 'by design' but then probably worth to mention in documentation.

The DSC configuration that is using the resource (as detailed as possible):
Not working:

            SqlAGReplica SecondReplica
            {
                Ensure                      = 'Present'
                Name                        = "$nodeName"
                AvailabilityGroupName       = $SQLAGName
                ServerName                  = $nodeName
                InstanceName                = $SQLInstanceName
                PrimaryReplicaServerName    = $SQLWSFCFirstNode
                PrimaryReplicaInstanceName  = $SQLInstanceName
                ProcessOnlyOnActiveNode     = $true
                PsDscRunAsCredential        = $SPInstallAccountCredential
                DependsOn                   = '[WaitForAll]WaitForAG'
            }

Working:

            SqlAGReplica SecondReplica
            {
                Ensure                      = 'Present'
                Name                        = "$nodeName\$SQLInstanceName"
                AvailabilityGroupName       = $SQLAGName
                ServerName                  = $nodeName
                InstanceName                = $SQLInstanceName
                PrimaryReplicaServerName    = $SQLWSFCFirstNode
                PrimaryReplicaInstanceName  = $SQLInstanceName
                ProcessOnlyOnActiveNode     = $true
                PsDscRunAsCredential        = $SPInstallAccountCredential
                DependsOn                   = '[WaitForAll]WaitForAG'
            }

Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
Windows Server 2016
WMF 5.1
What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
SqlServer 21.0.17199

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

@johlju
Copy link
Member

johlju commented Jan 26, 2018

I think this is already documented on the parameter Name here; https://github.com/PowerShell/SqlServerDsc#sqlagreplica

The name of the availability group replica. For named instances this must be in the following format SQLServer\InstanceName.

@johlju johlju added the question The issue is a question. label Jan 26, 2018
@johlju
Copy link
Member

johlju commented Jan 26, 2018

Although, maybe we should change 'SQLServer\InstanceName' to 'ServerName\InstanceName' since that is the naming convention we are using now for those parameters.

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. and removed question The issue is a question. labels Jan 26, 2018
@vors vors removed the help wanted The issue is up for grabs for anyone in the community. label Jan 26, 2018
@johlju
Copy link
Member

johlju commented Jan 26, 2018

Let's keep this open and track the update to the description in this issue. I will send in a PR fixing this and it will auto-close this issue once merged. 😄

@johlju johlju reopened this Jan 26, 2018
@johlju johlju added the in progress The issue is being actively worked on by someone. label Jan 26, 2018
johlju added a commit to johlju/SqlServerDsc that referenced this issue Jan 26, 2018
- Updated description for parameter Name in README.md and in comment-based help (issue dsccommunity#1034).
johlju added a commit that referenced this issue Jan 27, 2018
- Changes to SqlAGReplica
  - Updated description for parameter Name in README.md and in comment-based help (issue #1034).
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Mar 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants