In this recipe we will back up a local database to Azure.
Before we can back up our databases to Microsoft Azure Blob storage, there are a few things that need to be in place.
First, your Azure storage needs to be set up.
Second, you need to have a container.
Third, you need to know what your Azure storage access keys are. You can get them from your Azure storage page. The link should be at the bottom of the storage page screen, as shown in the following screenshot:
The steps to back up your database to Azure Blob storage are as follows:
Open PowerShell ISE as administrator.
Import the
SQLPS
module as follows:#import SQL Server module Import-Module SQLPS -DisableNameChecking
If one does not already exist, create a credential to use for the remote backup:
$instanceName = "localhost" $AzureStorageAccount = "replaceThisWithAzureStorageAccount" $storageKey = "replaceThisWithYourStorageKey" $secureString = ConvertTo-SecureString $storageKey...