Examples/Resources/SqlAlwaysOnService/1-EnableAlwaysOn.ps1

<#
.EXAMPLE
    This example shows how to enable SQL Server Always On high availability and
    disaster recovery (HADR).
#>

Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [System.Management.Automation.PSCredential]
        $SqlAdministratorCredential
    )

    Import-DscResource -ModuleName SqlServerDsc

    node localhost
    {
        SqlAlwaysOnService 'EnableAlwaysOn'
        {
            Ensure               = 'Present'
            ServerName           = 'SP23-VM-SQL1'
            InstanceName         = 'MSSQLSERVER'
            RestartTimeout       = 120

            PsDscRunAsCredential = $SqlAdministratorCredential
        }
    }
}