Setting up Server Core to back up to Azure Backup using PowerShell is not trivial and examples online are sparse. After much trial and error I figured it out and decided to share.
Follow the steps here https://docs.microsoft.com/en-us/azure/backup/backup-client-automation to set up your recovery vault, download and install the MARS agent, and register the client machine to a Recovery Services Vault. One gotcha with server core the GUI installer fails at the point where you browse to the vault credentials file. You need to register the machine using PowerShell:
Start-OBRegistration -VaultCredentials [path to credentials file]
To see a list of commands:
Get-Command -Module MSOnlineBackup
To set up a backup job:
$P = New-OBPolicy $S = New-OBSchedule -DaysOfWeek Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday -TimesOfDay 21:00 Set-OBSchedule -Policy $P -Schedule $S $RP = New-OBRetentionPolicy -RetentionDays 7 -RetentionWeeklyPolicy -RetentionWeeks 8 -WeekTimesOfDay 21:00 –Retention MonthlyPolicy -RetentionMonths 24 Set-OBRetentionPolicy -Policy $P -RetentionPolicy $RP $F = New-OBFileSpec -FileSpec @("D:\Temp") Add-OBFileSpec -Policy $P -FileSpec $F Set-OBPolicy -Policy $P
Note that the weekly retention time and the schedule time of day need to be the same, else it will throw an error.
Another useful tip: instead of trying to use cumbersome PowerShell scripts to do a recovery, install the MARSAgent on your computer and recover from "Another Server". This requires you to download fresh vault credentials from the Azure portal.
Hope this helps.