Lately I’ve been diving into the options of backing up SharePoint 2013. It’s a big and important topic, so today I’m going to show you how to backup your SharePoint 2013 farm configuration. I’ll also show you how to restore a SharePoint 2013 farm configuration and give you some use cases for when doing this is a good idea. All right, let’s dive in!
What Is a Farm Configuration?
The farm configurationis all of the items that make a farm your farm. It’s stored completely as a database in SQL. It’s the first database created when you create your SharePoint 2013 farm, and whenever you add a server to (or remove one from) the farm, the farm configuration database keeps those changes. (For more info, check out “Create a SharePoint 2013 Farm Configuration with PowerShell.”) A farm configuration keeps all of the information about how your farm is set up, from the service applications running on the farm to the web applications running on it.
However, when you talk about backing up the farm configuration the one thing you’re specifically excluding from your backup is the content in your SharePoint farm. Backing up the farm configuration keeps the farm straight, but not a single document is going to be included in the backup.
When to Backup a Farm Configuration
The first-use case is for pilot, development, and test farms. In those farms, the content was put in with no intention of the farm being the actual repository of the information. If the content goes away, it’s not going to impact you because the documents still live on a file share or on your own hard drive. In those cases, you do not need to backup the farm content – you’re only worried about backing up the configuration.
Backing up the farm configuration is useful for doing a migration from one farm to another. For instance, in cases where you’re ready to move to a production SharePoint farm and you want the environment to be the same as it is in the test, but you will be starting over with new content.
SharePoint 2013 Backup Requirements
You need some permissions on both the configuration database and on the server on which you’re running the SharePoint Command Shell.
- On SQL instance: securityadmin role.
- On SQL database (for any that you’re backing up): db_owner.
- On SharePoint server that you’re running SharePoint PowerShell on: Local Administrator
You also need a directory on which to put the backup. This can be a network share or a local file, but the backup will finish faster if you use a local directory. Then you can transfer the file across the network after it’s done.
Backup the SharePoint 2013 Configuration Database for the Current Farm
This is the most likely scenario. Occasionally, you want to connect to a different farm or to a restored configuration database that is no longer part of any farm, but most of the time this is what you want to do.
You can do this either through Central Administration or from the SharePoint PowerShell commands. I’ll go through both methods.
Backup Current Farm Configuration with Central Administration
- Open Central Administration. On the left side navigation, select Backup and Restore.
- On the Backup and Restore page, click Perform a backup.
- Select Farm, the highest level that you can select. This in turn selects everything. Click Next.
- Change the “data to back up” setting to Back up only configuration settings.
- Add your backup location and click Start backup.
Notice that at the Backup and Restore Job Status page there is now an indicator that a backup job is running (see below). This may take a few seconds to kick off, so if you think it should be running and it isn’t, then count to ten and refresh the page.
Backup Current Farm Configuration with PowerShell
Backing it up with PowerShell is even easier. Way fewer clicks.
- Open SharePoint Management Shell.
- At the prompt, type:
Backup-SPFarm –ConfigurationOnly -Verbose –Directory “C:\Backups\ConfigOnly” –BackupMethod Full
Backup Farm Configuration from a Restored Farm Configuration Database
Again, this is not what you’ll usually do, but if you have a configuration database that is no longer part of a farm of which you want to backup just the configuration, you have to use PowerShell. Central Administration will only work to backup the current farm configuration.
Luckily, the PowerShell command is not much more complicated. In its simplest form, it’s just the following:
Backup-SPConfigurationDatabase –DatabaseName “Restored_ConfigDatabase” –Directory “C:\Backups\OldFarmConfig”
There are some additional items you may need to know to make this happen. There is a parameter called DatabaseServer, but it uses the local host as the default. If you’re not running this from the SQL server then you need to provide that. Also, in the case that SQL credentials were used on the old database, then you can provide credentials using the DatabaseCredentials parameter.
Restore Farm Configuration in SharePoint 2013
Just like backing up the farm configuration, you can restore the farm configuration using either Central Administration or PowerShell
Restore SharePoint 2013 Farm Configuration from Backup with Central Administration
- Open Central Administration, and just like during the backup process above, select Backup and Restore from the left side navigation.
- Next, select Restore from a backup from the Farm Backup and Restore section.
At the next screen, take the following actions:
- Enter the directory where the backups are located.
- Select the backup you wish to restore from the list (there may be multiples in that backup folder).
- Click Next.
Restore SharePoint 2013 Farm Configuration with PowerShell
Open the SharePoint Management Shell. Enter the following command at the prompt:
Restore-SPFarm –Directory “C:\backups\ConfigOnly” –RestoreMethod Overwrite –ConfigurationOnly –Force
Notes about the Restore-SPFarm parameters: There are two acceptable options for the RestoreMethod parameter:
- Use Overwrite if you’re restoring to the same farm. If you use overwrite, then it will prompt you to confirm unless you use the –Force parameter.
- If you want to restore to a new farm, then use the –RestoreMethod New parameter. If you choose this, then you will have to give some more information, but PowerShell will prompt you for what it needs.
This command will restore the most recent backup stored in that backup location. If you want to specify an older backup to restore, then you need to supply it as a GUID to the –BackupID parameter. You can get the GUIDs for the backups by running the Get-SPBackupHistory cmdlet.
This covers the basics of what you need to know to backup and restore your farm configuration. You should test this process first by incorporating it into a backup and recovery plan for your SharePoint infrastructure. Also, it’s good to know that backing up the farm configuration is not enough to save your content. So use this as a tool and as part of your overall strategy – but don’t think that you’ve done all you need to by just saving your farm configuration.
Tagged with farm configuration