- 
                Notifications
    
You must be signed in to change notification settings  - Fork 108
 
SPDatabaseAAG
        Brian Farnhill edited this page Sep 21, 2016 
        ·
        19 revisions
      
    Parameters
| Parameter | Attribute | DataType | Description | Allowed Values | 
|---|---|---|---|---|
| DatabaseName | Key | string | The name of the database to put in the AlwaysOn group | |
| AGName | Required | string | Name of the AlwaysOn group on the SQL server - this must already exist | |
| FileShare | Write | string | The fileshare to use for the SQL backup when adding to the group | |
| Ensure | Write | string | Present if the database should be in this AlwaysOn group, or Absent if it should not be in the group | Present, Absent | 
| InstallAccount | Write | String | POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 | 
Description
This resource will allow specifying which SQL Server AlwaysOn Availability group a resource should be in. This resource does not configure the Availability Groups on SQL Server, they must already exist. It simply adds the specified database to the group.
Examples
Example 1
This example takes an existing SharePoint database and puts it in to the specified
AlwaysOn Availability Group (AAG).
Configuration Example 
{
    param(
        [Parameter(Mandatory = $true)]
        [PSCredential]
        $SetupAccount
    )
    Import-DscResource -ModuleName SharePointDsc
    node localhost {
        SPDatabaseAAG ConfigDBAAG
        {
            DatabaseName         = "SP_Config"
            AGName               = "MyAvailabilityGroup"
            FileShare            = "\\SQL\Backups"
            PsDscRunAsCredential = $SetupAccount
        }
    }
}
Example 2
This example removes a database from the specified AlwaysOn Availability Group (AAG)
Configuration Example 
{
    param(
        [Parameter(Mandatory = $true)]
        [PSCredential]
        $SetupAccount
    )
    Import-DscResource -ModuleName SharePointDsc
    node localhost {
        SPDatabaseAAG ConfigDBAAG
        {
            DatabaseName         = "SP_Config"
            AGName               = "MyAvailabilityGroup"
            Ensure               = "Absent"
            PsDscRunAsCredential = $SetupAccount
        }
    }
}

- Home
 - Getting Started
 - Pre-requisites
 - Installing the module
 - Exporting SharePoint Configuration
 - Creating Configuration Files
 - Pre-created Examples
 - Creating an Azure development environment
 - Understanding Resources & Syntax
 - Remote PowerShell Authentication
 - Contributing to SharePointDsc
 - Other useful modules for SharePoint DSC configurations