With the majority of server migrations, we always take a standard backup of the server to protect customer data and information and providing us an “oh shit” button if we need to recover the service due to a bad migration or an unforeseen circumstance.
While installing Azure Backup on most servers is a straight forward process via the GUI, there are a couple of painful aspects and failures that occur when trying this on server core.
Installing the MAR’s agent using PowerShell is fairly straight forward, however you do need to make sure the server has at least PowerShell 6.0.
Run the below script, which downloads the latest MARS agent on the machine. It will fail at the server registration due to wanting to load the GUI.
$URL = 'htts://aka.ms/azurebackup_agent' $WC = New-Object System.Net.WebClient $WC.DownloadFiles($MarsAURL,'C:\downloads\MARSAgentInstaller.EXE') C:Downloads\MARSAgentInstaller.EXE
To successfully register the agent with the vault download the vault credentials and dump them into a temp location on the server. Next run the below powershell command
Start-OBRegistration -VaultCredentials C:\temp (path to vaultcreds)
BAM! you should now see the agent reporting on the Microsoft Azure backup dashboard, which is a great starting point. Now we just need to define a backup policy and enable it all via PowerShell.
$Policy = New-OBPolicy $Schedule = New-OBSchedule -DaysOfWeek Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday -TimesOfDay 21:00 Set-OBSchedule -Policy $Policy -Schedule $Schedule $RetentionPolicy = New-OBRetentionPolicy -RetentionDays 30 Set-OBRetentionPolicy -Policy $Policy -RetentionPolicy $RetentionPolicy Set-OBRetentionPolicy -Policy $Policy -RetentionPolicy $RetentionPolicy $Location = New-OBFileSpec -FileSpec E:\Shares Add-OBFileSpec -Policy $Policy -FileSpec $Location Set-OBPolicy -Policy $Policy
Now we have a policy configured, we just need to configure the pass phrase which we will use to encypt our data.
$PassPhrase = ConvertTo-SecureString -String "A 16 Character Password!" -AsPlainText -Force Set-OBMachineSetting -EncryptionPassPhrase $PassPhrase -SecurityPin "<generatedPIN>"
Now, our server core will backup to azure!