Thursday, February 25, 2016

Backup Azure Web sites

provides a reliable web sites hosting infrastructure where sites data is replicated in Azure data centers for redundancy. However it is still important to do regular backups of the site’s content and databases in order to be able to recover from a human error, problematic upgrade or a hacking attempt. With the Azure Store Add-On Cloud Cellar it is easy to setup automated backup task that will run on a predefined schedule and will backup site content and database. This post explains how to do it.
To create an automated backup go to Windows Azure Portal Add-Ons tab and click “NEW”:
Select the “STORE” tab:
In the “Choose an Add-on” wizard page select “Automatic Backup”:
On next page select the plan that best suits your needs:
Complete the purchase and the newly purchased add-on will appear in the Add-Ons list view. Select it and then click “MANAGE” or “Go to the web site for the next steps”:
This will take you to the Cloud Cellar web site where you can setup backup tasks for your Azure Web Sites:
Depending on the plan that you select you can take advantage of various backup options. For example in Safe and Vault plans you can backup standalone Microsoft SQL Azure or MySQL databases. This is useful when your website is hosted in Azure Web Role and you want to keep a backup copy of its database. Another option available in those plans is On-Demand Backup, which you can trigger at any time. This can be used when you are about to deploy a new version of a site but want to snapshot the current site state “just in case”:
To enable those features as well as to get more frequent backups you can upgrade to Safe or Vaultplan from the Add-On dashboard page:

Wednesday, February 3, 2016

Backup the enter system disk into azure using backup vault


1. Create Windows Azure Backup Vault


  • To create the backup vault login to windows azure and from the left pane bottom section you can select "New" option, which in turn displays a new page for creating new items in windows azure.
  • Now select DATA SERVICES -> RECOVERY SERVICES -> BACKUP VAULT -> QUICK CREATE as shown below,
Windows Azure Portal

  • Now the Windows Azure Backup Vault creation is completed.

2. Create certificate using makecert command

Windows Azure Backup Vault authenticates the servers using SSL certificate. We need to create a client authentication certificate using makecert. This certificate will be uploaded to the created backup vault. And also we need to install this certificate in the servers that will work with Windows Azure Backup Vault. Servers with this certificate can alone be registered with the created Windows Azure Backup Vault.

We need to store this certificate in secure place for future use. In case of the server crash, when we create a server and restore the backup items to the new server from the Windows Azure Backup Vault, we need to install this certificate to register with the Windows Azure Backup Vault.

The created certificate should have
  • Client athentication Enhanced Key Usage(eku)
  • Minimum of 2048 bit key length
  • Validity period less than 3 years

As a first step in Server1, let's create a certificate using the makecert command as given below,
makecert.exe -r -pe -n CN=CertificateName -ss my -sr localmachine -eku 1.3.6.1.5.5.7.3.2 -len 2048 -e 01/01/2016 YourCertificateName.cer
Checkout this link on options available in makecert command.
  • By default makecert.exe will not be available. MakeCert is available as part of the Windows SDK, which you can download from this link
  • After installing the Windows SDK, to create certificate you need to open command prompt and navigate to this path "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin" and execute the command as given below,
makecert command

  • Now the certificate creation is completed.

3. Export certificate to .PFX format

Now export this certificate to .PFX format and store it in a secure location different from this server for future use.

NOTE:

A .PFX file is an encrypted security file that stores secure certificates for authenticating people or devices. In simple words, .PFX file is a storage format which needs to be stored in a secured location and in future it can be changed to .CER format for website authentication.

A .CER file is a security file that is used to verify the authenticity of a website. In simple words, .CER is a deployable format for the authentication of a website.
Steps to export the certificate to .PFX format,
  • Open MMC and connect to Certificates snap-in as shown in the below screenshot,
mmc console

  • After connecting to the Certificates snap-in, in the left pane navigate to Personal Certificates folder and right click on the certificate created using makecert and export it as shown below,
mmc certificates

  • Now follow the below screenshots for steps to export the certificate in .PFX format from the Server1,
Export certificate private key

Export certificate file format

Secure certificate private key

  • Finally browse the file path and export the certificate in .PFX format as given below,
Export certificate as pfx

  • Now the certificate is exported to .PFX format.

4. Export certificate to .CER format

In this section we will export the certificate to .CER format for uploading it to Windows Azure Backup.

Steps to export the certificate to .CER format,
  • For opening MMC and connecting the Certificates snap-in, you can repeat the first two steps as in section "Export certificate to .PFX format".
  • Now follow the below screenshots for steps to export the certificate in .CER format from the Server1,
Export CER private key

Export CER file format

  • Finally browse the file path and export the certificate in .CER format as given below,
Export CER

  • Now the certificate is exported to .CER format.

5. Upload .CER certificate to Windows Azure Backup Vault

To create the authentication between the server and the windows azure, you need to upload the exported certificate in .CER format to Windows Azure Backup Vault.

Steps to upload .CER certificate to Windows Azure Backup Vault,
  • Now login to windows azure from the Server1.
  • In the windows azure portal, from the left pane, navigate to Recovery Services and select the Backup Vault and click "Manage Certificate" as show below,
Manage certificate in portal

  • As a result, a pop-up appears, in which provide the file path of the certificate for uploading the certificate to the windows azure as shown below,
Upload CER in portal

  • Now the certificate is uploaded to windows azure, this confirms that the authentication is created between the server and the windows azure backup vault.

6. Download and Install Windows Azure Backup Agent


  • Now from Server1, login to windows azure and click the Backup Vault, this in turn opens a page with download link for Windows Azure Backup Agent as shown below,
Download Azure Backup Vault Agent

  • Once the agent is downloaded, you can run the setup. The setup name of the Windows Azure Backup Agent will be "WABInstaller.exe".
  • After the installation, you can access the Windows Azure Backup Agent using the desktop shortcut as shown below,
Backup agent desktop shortcut

  • Next step is registering the server to the Windows Azure backup Vault.

7. Register Server1 to Windows Azure Backup Vault


  • After opening the Windows Azure Backup agent, you need to register the server to the Backup vault by clicking "Register Server" option as shown below,
Register Server1 in Backup Vault

  • After clicking "Register Server" option, proxy configuration page appears; you can either configure or skip it,
Register Server1 proxy configuration

  • Browse for certificate to register with Windows Azure Backup Vault. Once you click browse, it will automatically detect the certificate as shown below,
Register Server1 vault certificate selection

  • Once you click OK, certificate confirmation will take place and fetches the Backup Vault as shown below,
Register Server1 vault identification

  • Finally provide the passphrase by clicking "Generate Passphrase", save the passphrase in a secured location and it should be in a different location from the data to be backed up. Finally click "Register" to confirm registration.
Server1 passphrase

  • After the above step, the server will be registered to Windows Azure Backup Vault. So that it can backup and recover data from Windows Azure backup Vault.
Note: The generated passphrase is used to encrypt and decrypt the backup files. The generated passphrase is needed when you restore the files from the Windows Azure Backup Vault, so store it in secure location for future use.

8. Scheduling Backup from Server1 to Windows Azure Backup Vault


  • To schedule the backup from Server1, open the Windows Azure Back Agent and select the "Schedule Backup" option as shown below,
Schedule azure backup in Server1

  • Here, I skip the "Getting Started Screen". So let's start with selecting the items for backup. Using "Add Items" you can add your required data for backup, also you exclude specific files or folders using "Exclusion Settings".
Select items to backup in Server1

  • Now I choose my data to be backed up in Windows Azure Backup Vault as shown below,
Backup items in Server1

  • After the confirmation of data for backup, now specify the day of the week and time for running the backup schedule as shown below,
Backup time in Server1

  • Now specify the days for backup retention, which indicates the files deleted, renamed, moved, then the older files will remain for the number of days as specified in this section.
Backup retention settings in Server1

  • Finally the scheduling backup is completed, click Finish to confirm.
Finish backup configuration in Server1

  • Now the steps for scheduling backup to Windows Azure are completed.
  • For testing purpose, let us force the backup to run using the “Back Up Now” option as shown below,
Run backup schedule in Server1

  • From the above screenshot, it is confirmed that a backup job has been successfully completed from Server1 to Windows Azure Backup Vault.

9. Server1 crashed

Now let's consider a situation that due to some reasons Server1 is crashed, but the data in Server1 are securely backed up to Windows Azure Backup Vault.

10. Recovering data from Windows Azure Backup Vault to Server2

Before recovering the backed up data to Server2, we need complete the following steps
  • Import the .PFX certificate exported from Server1 to this server
  • Download and Install Windows Azure Backup Agent in Server2
  • Register Server2 to Windows Azure Backup Vault
To import the .PFX certificate exported from Server1,
  • First copy the exported .PFX certificate from the secured location to this server.
  • To import the certificate, right click the certificate and select "Install PFX" option as shown below,
Install PFX in Server2

Regarding the following steps,
  • Download and Install Windows Azure Backup Agent in Server2
  • Register Server2 to Windows Azure Backup Vault
You can repeat the same steps done for Server1 as specified in the sections 6. Download and Install Windows Azure Backup Agent and 7. Register Server1 to Windows Azure Backup Vault respectively.
  • After completing the above steps, we can recover the data backed up from Windows Azure Backup Vault.
  • Now from Server2, you need to open the Windows Azure Backup Agent and select the recover option as shown below,
Recover backup data in Server2

  • Now the Recover Data Wizard opens, since we need to recover data which is backed up from Server1, I select "Another Server" as shown below,
Select another server

  • Now I select the Backup server as Server1.
Select Server1 as backup server

  • Now I browse for the files and select the volume to recover the backup data from Server1 as shown below,
Select recovery mode

  • Now I select the volume and date of backup for recovering the data,
Select volume and date

  • Now I select the items to recover,
Select items to recover

  • Now I select the recovery location and additional options,
Select recovery location

  • To confirm the data recovery from Windows Azure Backup Vault for the data backed up from Server1, copy and paste the passphrase from the passphrase file generated during Scheduling Backup in Server1,
Recovery confirmation

  • Finally the backed up data from Server1 is successfully recovered to the Server2 using Windows Azure Backup Vault.
Recovery progress