Skip to content

Commit

Permalink
Merge pull request #55 from Matticusau/Issue51
Browse files Browse the repository at this point in the history
Fixes issue 51
  • Loading branch information
mbreakey3 committed Jul 28, 2016
2 parents 1f1f179 + 3f476dd commit 3738f26
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ function Set-TargetResource
[System.String]
$AutoBackupPrefernce ="Primary",

[System.UInt32]
$EndPointPort ="5022",

[System.String]
$SQLServer = $env:COMPUTERNAME,

Expand Down Expand Up @@ -156,7 +159,7 @@ function Set-TargetResource
Try
{
$Replica = New-Object -typename Microsoft.SqlServer.Management.Smo.AvailabilityReplica -ArgumentList $availabilityGroup, $node
$Replica.EndpointUrl = "TCP://$($node):5022"
$Replica.EndpointUrl = "TCP://$($node):$EndPointPort"
$Replica.FailoverMode = [Microsoft.SqlServer.Management.Smo.AvailabilityReplicaFailoverMode]::Automatic
$Replica.AvailabilityMode = [Microsoft.SqlServer.Management.Smo.AvailabilityReplicaAvailabilityMode]::SynchronousCommit
#Backup Priority Gives the ability to set a priority of one secondany over another valid values are from 1 - 100
Expand All @@ -179,7 +182,7 @@ function Set-TargetResource
Try
{
$asyncReplica = New-Object -typename Microsoft.SqlServer.Management.Smo.AvailabilityReplica -ArgumentList $availabilityGroup, $node
$asyncReplica.EndpointUrl = "TCP://$($node):5022"
$asyncReplica.EndpointUrl = "TCP://$($node):$EndPointPort"
$asyncReplica.FailoverMode = [Microsoft.SqlServer.Management.Smo.AvailabilityReplicaFailoverMode]::Manual
$asyncReplica.AvailabilityMode = [Microsoft.SqlServer.Management.Smo.AvailabilityReplicaAvailabilityMode]::ASynchronousCommit
$asyncReplica.BackupPriority = 50
Expand Down Expand Up @@ -308,6 +311,9 @@ function Test-TargetResource
[System.String]
$AutoBackupPrefernce="Primary",

[System.UInt32]
$EndPointPort ="5022",

[System.String]
$SQLServer = $env:COMPUTERNAME,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class MSFT_xSQLAOGroupEnsure : OMI_BaseResource
[Write] Uint32 AvailabilityGroupPort;
[Write, ValueMap{"None","ReadOnly","ReadIntent"}, Values{"None","ReadOnly","ReadIntent"}] String ReadableSecondary;
[Write, ValueMap{"Primary","Secondary"}, Values{"Primary","Secondary"}] String AutoBackupPrefernce;
[Write] Uint32 EndPointPort;
[Write] String SQLServer;
[Write] String SQLInstanceName;
[Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to Grant Permissions in SQL.")] String SetupCredential;
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ Please check out common DSC Resources [contributing guidelines](https://github.c
* **AvailabilityGroupPort** Port availability group should listen on
* **ReadableSecondary** Mode secondaries should operate under (None, ReadOnly, ReadIntent)
* **AutoBackupPreference** Where backups should be backed up from (Primary,Secondary)
* **EndPointPort** The TCP port for the SQL AG Endpoint (default 5022)
* **SQLServer**: The SQL Server for the database
* **SQLInstance**: The SQL instance for the database
* **SetupCredential**: (Required) Credential to be used to Grant Permissions on SQL Server
Expand Down

0 comments on commit 3738f26

Please sign in to comment.