-
Notifications
You must be signed in to change notification settings - Fork 224
SqlWaitForAG
dscbot edited this page Oct 26, 2024
·
10 revisions
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
InstanceName | Key | String | The name of the SQL Server instance to be configured. | |
ServerName | Write | String | The host name of the SQL Server to be configured. Default value is the current computer name. | |
Name | Key | String | Name of the cluster role/group to look for (normally the same as the Availability Group name). | |
RetryIntervalSec | Write | UInt64 | The interval, in seconds, to check for the presence of the cluster role/group. Default value is 20 seconds. When the cluster role/group has been found the resource will wait for this amount of time once more before returning. |
|
RetryCount | Write | UInt32 | Maximum number of retries until the resource will timeout and throw an error. Default values is 30 times. |
|
GroupExist | Read | Boolean | Returns $true if the cluster role/group exist, otherwise it returns $false . Used by Get. |
The SqlWaitForAG
DSC resource will wait for a cluster role/group to be
created. When the cluster group is found it will wait for the availability group to become available.
When the availability group has been found the resource will wait the amount of time specified
in the parameter RetryIntervalSec before returning.
- Target machine must be running Windows Server 2012 or later.
- Target machine must be running SQL Server Database Engine 2012 or later.
- Target machine must have access to the Failover Cluster PowerShell module.
- The account running this resource must have permission in the cluster to be able to run the cmdlet Get-ClusterGroup.
All issues are not listed here, see here for all open issues.
This example will wait for the cluster role/group 'AGTest1'.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlWaitForAG 'SQLConfigureAG-WaitAGTest1'
{
Name = 'AGTest1'
RetryIntervalSec = 20
RetryCount = 30
InstanceName = 'MSSQLSERVER'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}
This example will wait for both the cluster roles/groups 'AGTest1' and 'AGTest2'.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlWaitForAG 'SQLConfigureAG-WaitAGTest1'
{
Name = 'AGTest1'
RetryIntervalSec = 20
RetryCount = 30
InstanceName = 'MSSQLSERVER'
PsDscRunAsCredential = $SqlAdministratorCredential
}
SqlWaitForAG 'SQLConfigureAG-WaitAGTest2'
{
Name = 'AGTest2'
RetryIntervalSec = 20
RetryCount = 30
InstanceName = 'MSSQLSERVER'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}
- Add-SqlDscNode
- Add-SqlDscTraceFlag
- Complete-SqlDscFailoverCluster
- Complete-SqlDscImage
- Connect-SqlDscDatabaseEngine
- ConvertFrom-SqlDscDatabasePermission
- ConvertFrom-SqlDscServerPermission
- ConvertTo-SqlDscDatabasePermission
- ConvertTo-SqlDscServerPermission
- Disable-SqlDscAudit
- Disconnect-SqlDscDatabaseEngine
- Enable-SqlDscAudit
- Get-SqlDscAudit
- Get-SqlDscConfigurationOption
- Get-SqlDscDatabasePermission
- Get-SqlDscManagedComputer
- Get-SqlDscManagedComputerService
- Get-SqlDscPreferredModule
- Get-SqlDscServerPermission
- Get-SqlDscStartupParameter
- Get-SqlDscTraceFlag
- Import-SqlDscPreferredModule
- Initialize-SqlDscRebuildDatabase
- Install-SqlDscServer
- Invoke-SqlDscQuery
- New-SqlDscAudit
- Remove-SqlDscAudit
- Remove-SqlDscNode
- Remove-SqlDscTraceFlag
- Repair-SqlDscServer
- Save-SqlDscSqlServerMediaFile
- Set-SqlDscAudit
- Set-SqlDscDatabasePermission
- Set-SqlDscServerPermission
- Set-SqlDscStartupParameter
- Set-SqlDscTraceFlag
- Test-SqlDscIsDatabasePrincipal
- Test-SqlDscIsLogin
- Test-SqlDscIsSupportedFeature
- Uninstall-SqlDscServer
- SqlAG
- SqlAGDatabase
- SqlAgentAlert
- SqlAgentFailsafe
- SqlAgentOperator
- SqlAGListener
- SqlAGReplica
- SqlAlias
- SqlAlwaysOnService
- SqlAudit
- SqlConfiguration
- SqlDatabase
- SqlDatabaseDefaultLocation
- SqlDatabaseMail
- SqlDatabaseObjectPermission
- SqlDatabasePermission
- SqlDatabaseRole
- SqlDatabaseUser
- SqlEndpoint
- SqlEndpointPermission
- SqlLogin
- SqlMaxDop
- SqlMemory
- SqlPermission
- SqlProtocol
- SqlProtocolTcpIp
- SqlReplication
- SqlRole
- SqlRS
- SqlRSSetup
- SqlScript
- SqlScriptQuery
- SqlSecureConnection
- SqlServiceAccount
- SqlSetup
- SqlTraceFlag
- SqlWaitForAG
- SqlWindowsFirewall