Saturday, February 1, 2014

Restoring based on Lync 2013 Backup script. Part 4

Disaster recovery?
Have you tried my Backup Script at the Technet Gallery, but now you're wondering what to do with the backup? How do you restore? What goes where and why?

This is the third of a couple of blog posts trying to explain a couple of concepts regarding backup.

Before reading this post, It is recommend to become familiar with the Basics, CsConfiguration and Topology described in Part 1 as these are the pillars of the deployment, part 2 regarding CsLisConfiguration, RgsConfiguration and UserData and part 3 regarding voice policies and settings, Filestore backup and persitant Chat.

($_.thumbprint).pfx
Certificates is the only thing I feel this backup script does not fully cover. The backup script only collects the certificate on the server where the script is run.:
dir cert:\localmachine\my | 
      Where-Object { $_.HasPrivateKey -and $_.PrivateKey.CspKeyContainerInfo.Exportable } | 
      Foreach-Object { [system.IO.file]::WriteAllBytes( 
               $filepath1 + "\$($_.thumbprint).pfx", 
               ($_.Export('PFX', 'secret')) ) }
In the event of a failure in your entire infrastructure, there must also be a backup of the certificates on the edge servers and the revers proxy (servers the front end server might not be able to reach when running the script). If the external certificates are installed on the frontend server as well (not always recommended), the backup will take care of them to.

To restore the certificate, simply use the "Lync deployment wizard" and launch the task "assign certificates". From this wizard, it's easy to import the pfx file and to assign it to the correct services.

db_name.bak
In addition to all the settings and configuration takes backup of. I always like to have a sound backup of the entire set of databases on my backend server.
In Lync 2013 (or should I say SQL 2012) the backup and restore procedure has really been simplified for users of powershell. The backup code is now limited to a couple of lines:
$cdate = Get-Date -Format MMddyy
foreach($database in (Get-ChildItem -name -force)) {
    $dbName = $database
    $bakFile = $dest + "\" + $dbName + "_full_" + $cdate + ".bak"
    If($dbName -ne "tempdb"){
        If(-not(Test-Path -path $bakFile)){
            Backup-SqlDatabase -Database $dbName -BackupFile $bakFile -Initialize}
        Else {Write-Output ("File already exist, presuming backup of mirror DB")
        }}}}
The Backup-SqlDatabase is the key to the easy backup.

Restoring is just as simple as the backup. Use the Restore-SqlDatabase command to restore one or more databases in the instance.

Allan White has written a very good post on the entire SQL Server Backup and Restore methods. It is worth reading through to get an overview over a few simple concepts.

The ZIP file
In the end, the entire backup is stored in a single zipfile. This file should be backed up by a regular file backup and/or stored in a secure location.

This concludes the four part series regarding backup and restore of Lync 2013. I hope this has been informational and helpful.

The other posts in the series:
Part 1:http://tech.rundtomrundt.com/2014/01/restoring-based-on-lync-2013-backup.html
Part 2:http://tech.rundtomrundt.com/2014/01/restoring-based-on-lync-2013-backup_22.html
Part 3:http://tech.rundtomrundt.com/2014/01/restoring-based-on-lync-2013-backup_25.html