Azure Backup MARS agent: files and folders

The Azure MARS agent (Microsoft Azure Recovery Services agent) backs up the files, folders and system state you choose from a Windows machine straight into an Azure vault. There’s no backup server and no tapes. You install the agent, register it, pick your folders and set a schedule.

It’s the easiest way to get off-site backups for on-premises file servers, branch office machines, or the handful of folders on a VM that matter. It’s also where admins lose data, usually by forgetting a passphrase or an exclusion rule.

For this lab your own Windows laptop plays the “on-premises server”. You’ll back up C:\azure-lab and restore a file, and then work out why one file is missing from the backup and why the vault won’t go away.

TimeYou needCostBy the end you can
About 60 minutesA Windows 10 or 11 laptop where you are an administrator, the CLI, Az PowerShellA few US cents: a protected-instance fee for a few days and a few MB of backup storageInstall and register MARS, schedule and restore file backups, and troubleshoot missing files

What it is, in one line

The MARS agent backs up files, folders and system state from a Windows machine straight into a Recovery Services vault.

In Simple Words

Posting copies of your homework to grandma

Every evening you photocopy the folders you care about and post them to grandma, who keeps them in a locked box, so if your bag goes missing you just ask her for yesterday’s copy. That’s MARS, with your laptop as home and the vault as grandma’s house. Each envelope gets a padlock whose code only you know: grandma can’t open it, and nobody can tell you the code later, and that code is the passphrase. And if you told yourself “don’t bother copying the rough notes”, don’t be surprised when they aren’t in grandma’s box. That’s an exclusion.

Engineer's View

How MARS works

  • What it protects: files, folders and Windows system state, on Windows Server and Windows client, physical or virtual, on-premises or in any cloud.
  • Registration: you register the machine with a vault credentials file from the Recovery Services vault, which stays valid for 10 days. Every registered machine shows up under Protected servers.
  • Encryption: the data is encrypted on the machine before it leaves, using a passphrase of at least 16 characters. Microsoft doesn’t keep that passphrase, so if you lose it you can’t restore to another machine.
  • Schedule and retention: up to three backups a day, with daily, weekly, monthly and yearly retention. Once the first full copy is done, only the changed blocks get sent.
  • Cache folder: the agent keeps its metadata in a scratch folder (under its install path by default), and that folder needs free space of roughly 5 to 10% of the data size.
  • Network: it needs HTTPS 443 out to the Azure Backup and Entra ID endpoints, and proxies that inspect SSL are a common reason it fails.
  • Restore: you can get single files back by mounting a recovery point as a drive letter, or restore a whole volume. Restoring to “Another server” needs the passphrase.

How it works, step by step

This is what happens at 21:30 when the scheduled backup kicks in:

Azure MARS agent backup flow from a Windows machine to the vault
  1. The agent takes a VSS snapshot of the volume, so even open files get copied in a consistent state.
  2. Using the metadata in its cache folder, it compares the files with the last backup.
  3. The changed blocks are compressed and then encrypted with your passphrase.
  4. They go over HTTPS to the vault and are stored there as a new recovery point.
  5. The result of the job shows up in the agent console and under the vault’s Backup jobs.

MARS doesn’t know or care whether the machine is in Azure, which is why it’s the usual answer when someone says “we need off-site copies of this one file server”.

Azure MARS agent problems: passphrase, exclusions and orphaned servers

For whole Azure VMs you’d use Azure VM backup (Lesson 35). For big on-premises estates with lots of workloads, enterprise tools (Lessons 37 and 38) or Azure Backup Server take over.

Hands-on lab: the Azure MARS agent on your laptop

Before you run any command, double-check it

Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.

Open PowerShell as administrator on your laptop.

1Create a vault for MARS

Run this:

az backup vault create --resource-group rg-saat-core --name rsv-saat --location centralindia --tags course=saatvedha-azure lesson=36 -o none
az backup vault backup-properties set --resource-group rg-saat-core --name rsv-saat --backup-storage-redundancy LocallyRedundant -o none

2Get the vault credentials and the agent

Install the Recovery Services module once, sign in, and then download both files:

Install-Module Az.RecoveryServices -Scope CurrentUser
Connect-AzAccount
$vault = Get-AzRecoveryServicesVault -ResourceGroupName rg-saat-core -Name rsv-saat
Get-AzRecoveryServicesVaultSettingsFile -Backup -Vault $vault -Path C:\azure-lab
Invoke-WebRequest -Uri https://aka.ms/azurebackup_agent -OutFile C:\azure-lab\MARSAgentInstaller.exe

You should see something like this:

FilePath
--------
C:\azure-lab\rsv-saat_Thu Oct 22 2026.VaultCredentials

The credentials file stays valid for 10 days. Treat it like a password, because anyone who has it can register a machine to your vault.

3Install and register the agent

Install silently:

Start-Process -FilePath C:\azure-lab\MARSAgentInstaller.exe -ArgumentList '/q', '/nu' -Wait

Open Microsoft Azure Backup from the Start menu and choose Register Server. Browse to the .VaultCredentials file, and on the Encryption Setting page click Generate Passphrase. Save the passphrase in your password manager, not in C:\azure-lab.

Click Finish.

Azure MARS agent register server encryption passphrase
Register the laptop: generate the passphrase and save it in your password manager.

Now check the registration from the Azure side:

az backup container list --resource-group rg-saat-core --vault-name rsv-saat --backup-management-type MAB --query "[].{server:properties.friendlyName, status:properties.registrationStatus}" -o table

You should see something like this:

Server             Status
-----------------  ----------
laptop-priya.home  Registered

4Schedule and run a backup

In the agent console, choose Schedule Backup and add the folder C:\azure-lab. Leave the exclusions empty for the moment.

Set one backup a day at 21:30, keep daily backups for 30 days and pick Online initial backup. Click Finish, then Back Up Now, and wait for the job to show Completed.

Azure MARS agent backup job completed
The first backup of C:\azure-lab has Completed.

Check the job from PowerShell on your laptop:

Import-Module 'C:\Program Files\Microsoft Azure Recovery Services Agent\bin\Modules\MSOnlineBackup'
Get-OBJob -Previous 1 | Select-Object -ExpandProperty JobStatus | Select-Object JobState, StartTime, EndTime

You should see something like this:

JobState   StartTime              EndTime
--------   ---------              -------
Completed  22-10-2026 10:41:05    22-10-2026 10:43:52

5Restore a single file

Delete C:\azure-lab\vnet-saat.json (the backup has a copy). In the agent console, choose Recover Data, This server, Individual files and folders, volume C:, and today’s recovery point. When you click Mount, the recovery point shows up as a new drive letter.

Copy vnet-saat.json from that drive back into C:\azure-lab, and then click Unmount.

Azure MARS agent mount recovery point
The recovery point mounted as drive E:.

Check that the file is back:

Test-Path C:\azure-lab\vnet-saat.json

You should see this:

True
Azure MARS agent lab: credentials, registration, backup job and restore
Credentials file, registration, a completed job, and a restored file.

✅ Checkpoint: Your laptop is registered to rsv-saat, C:\azure-lab has a completed backup, and you restored vnet-saat.json from it.

Break It, Then Fix It

Both of these come in as “the backup is broken” tickets, and in both cases it isn’t.

1Break it: the file that was never backed up

Create a log file, and then add an exclusion that a lot of admins use to save space:

New-Item -ItemType Directory -Path C:\azure-lab\logs -Force | Out-Null
Set-Content -Path C:\azure-lab\logs\app.log -Value 'important line'

In the agent console, go to Schedule Backup, Change backup items, Exclusion Settings, and add the file type *.log for C:\. Finish, then Back Up Now. After that, delete C:\azure-lab\logs\app.log and try to recover it from today’s new recovery point the way you did in step 5.

Azure MARS agent exclusion leaves a file out of the backup
The logs folder in the new recovery point: no app.log.

Look for the file in the mounted recovery point:

Get-ChildItem -Path E:\azure-lab\logs -ErrorAction SilentlyContinue | Select-Object Name

You should see nothing, because the folder is empty or not there (use your own mount’s drive letter in place of E:).

The backup ran perfectly. It never included .log files because you told it not to, and exclusions apply quietly to every backup from then on. So when a user says “it was in that folder”, look at the exclusions before anything else.

Fix it: remove the *.log exclusion in Schedule Backup and back up again. New log files are protected from the next run onwards, but the deleted one is gone for good, because no recovery point ever had it.

2Break it: the vault that won’t go away

Pretend the laptop has been retired, and try to delete the vault while it’s still registered:

az backup vault delete --resource-group rg-saat-core --name rsv-saat --yes

You’ll get this error:

Vault cannot be deleted as there are existing resources within the vault. Please ensure there are no backup items, protected servers, or backup management servers associated with this vault. Unregister the following containers associated with this vault before proceeding for deletion.

The registered laptop counts as a “protected server”, and its backups count as “backup items”. If you uninstall the agent from the laptop first, neither goes away, and you’re left with an orphan in the vault.

Fix it, in the right order:

  1. In the agent console, choose Schedule Backup, then Stop using this backup schedule and delete all the stored backups. If it asks, confirm with the security PIN from the vault (Properties, Security PIN).
  2. In the portal, open rsv-saat and go to Backup infrastructure, Protected servers, Azure Backup Agent, then select your laptop and Delete.
  3. Then uninstall Microsoft Azure Recovery Services Agent from Settings, Apps.
az backup container list --resource-group rg-saat-core --vault-name rsv-saat --backup-management-type MAB -o tsv
az backup vault delete --resource-group rg-saat-core --name rsv-saat --yes

The list prints nothing. The delete can still fail with the soft delete message you saw in Lesson 35:

Recovery Services vault cannot be deleted as there are backup items in soft deleted state in the vault. ...

That’s fine, keep rsv-saat. It costs nothing while it’s empty, there’s no charge for the soft-deleted data, and Lesson 39 needs a Recovery Services vault again. Also delete the two files you downloaded, the credentials file included, from C:\azure-lab.

Remove-Item C:\azure-lab\*.VaultCredentials, C:\azure-lab\MARSAgentInstaller.exe
Remove-Item C:\azure-lab\logs -Recurse
Azure MARS agent errors: excluded files and a vault that will not delete
Excluded files never reach the vault, and a registered server blocks vault deletion.

✅ Checkpoint: You found an exclusion hiding files, removed the laptop from the vault in the right order, and deleted the credentials file.

This happened at work

The branch office restore that needed a passphrase

A retail chain was backing up the file server in each of its 40 shops with MARS. When one shop’s server died completely, the IT team built a new one, installed MARS, registered it to the vault and picked “Another server” to restore the shop’s files.

The wizard asked for the old server’s passphrase, and nobody had it. The installer had generated it two years earlier and saved it to a file on the old server’s own C: drive. Microsoft doesn’t store passphrases, so every backup was sitting right there in the vault and none of it could be decrypted. In the end the shop rebuilt its files from emails and paper.

What they changed: every passphrase now goes into the company password vault on the day the agent is installed, and a monthly check confirms each server has its passphrase entry. Twice a year, IT does a test restore of one shop onto a spare machine using “Another server”.

Common mistakes and troubleshooting

MistakeWhat you seeWhat to do
Passphrase saved only on the server itselfCan’t restore after the server diesKeep it in a password vault, tested.
Exclusions added and forgottenFiles missing from every recovery pointReview exclusions when a restore fails.
Vault credentials file older than 10 daysRegistration failsDownload a fresh credentials file.
Cache folder on a nearly full diskBackups fail or slow downMove the cache to a disk with space.
Uninstalling the agent before cleaning the vaultOrphaned server; vault won’t deleteStop backup, delete data, delete the server, then uninstall.
SSL-inspecting proxy in the pathConnection errors to AzureBypass inspection for Azure Backup endpoints.

Interview questions

Click any question to open it. They’re worded the way an interviewer would ask them, and under each one you’ll find why they ask it and one way you could answer in your own words.

Fresher level

1. What is the MARS agent?

Why they ask this: To see if you know the basic idea.

How you might answer: It’s the Microsoft Azure Recovery Services agent. It backs up files, folders and system state from Windows machines straight to a Recovery Services vault, and you don’t need a backup server.

2. What do you need to register a server with MARS?

Why they ask this: It’s a basic setup question.

How you might answer: You need a Recovery Services vault, a vault credentials file you downloaded from it in the last 10 days, the agent installed, and an encryption passphrase of at least 16 characters.

3. Can Microsoft recover a lost MARS passphrase?

Why they ask this: It’s a warning everyone should know.

How you might answer: No. The data is encrypted on the machine with the passphrase and Microsoft never stores it, so without it you can’t restore to another machine.

2–5 years experience

4. A user says a file is missing from yesterday’s backup. How do you investigate?

Why they ask this: It’s a real ticket.

How you might answer: I’d confirm the job succeeded, then look at the protected items and exclusions in the schedule, whether the file even existed at backup time, and any file type or path exclusions. After that I’d mount the recovery point and look for myself.

5. MARS backups started failing after a network change. What do you check?

Why they ask this: They want to see you think about the network.

How you might answer: I’d check outbound HTTPS to the Azure Backup and Entra ID endpoints, any new proxy or SSL inspection, DNS resolution and the agent’s logs. Testing from the server to the endpoints usually shows you the problem.

6. When would you use MARS instead of Azure VM backup?

Why they ask this: They want to see you pick the right tool.

How you might answer: For Windows machines on-premises or in another cloud, or when only some folders on an Azure VM need protecting. For a whole Azure VM, VM backup is simpler and brings back the entire machine.

Senior level

7. How would you run MARS across 200 branch servers?

Why they ask this: They’re checking scale.

How you might answer: I’d script silent installs and register with PowerShell, use standard policies, and keep each server’s passphrase in a password vault. The vault would alert on failed jobs, and I’d run a restore test per region every year. If the needs got bigger, I’d look at Azure Backup Server or an enterprise backup tool.

8. How do you protect MARS backups from an attacker on the server?

Why they ask this: They want security depth.

How you might answer: I’d turn on soft delete and the security PIN requirement on the vault, so critical operations need a PIN from the portal. Then separate admin accounts for the vault, alerts on deletions, and immutable vault settings where they’re available.

9. What are MARS’s limits?

Why they ask this: They want you to be honest about what the tool can’t do.

How you might answer: It’s Windows only, it works at file, folder or system state level, it does at most three backups a day, and restores need the passphrase. It isn’t application-aware for databases either, so SQL or Exchange need something else.

Quick quiz

Q1. Which OS does the MARS agent support?

  1. Linux only
  2. Windows
  3. macOS
  4. Any
Show answer

B — MARS runs on Windows Server and client.

Q2. How long is a vault credentials file valid?

  1. 1 day
  2. 10 days
  3. 90 days
  4. Forever
Show answer

B — Download a fresh one if it’s older than 10 days.

Q3. What is the minimum passphrase length?

  1. 8
  2. 12
  3. 16
  4. 32
Show answer

C — At least 16 characters.

Q4. A *.log exclusion was added. What happens to .log files?

  1. Backed up anyway
  2. Never included
  3. Moved to Archive
  4. Encrypted twice
Show answer

B — Excluded types are silently skipped.

Q5. Why does a vault with a registered MARS server refuse deletion?

  1. Wrong region
  2. It has protected servers and items
  3. The passphrase is weak
  4. Soft delete is off
Show answer

B — Remove backup data and the server first.

Quick recap

You can now back up and restore files from any Windows machine to Azure, and you know the classic traps to stay out of.

  • MARS backs up files, folders and system state to a vault.
  • Credentials file valid 10 days; passphrase at least 16 characters.
  • Store the passphrase safely; Microsoft can’t recover it.
  • Exclusions silently skip files; check them first.
  • Clean up in order: data, server, then agent.

Next lesson

Lesson 37: Commvault with Azure Blob storage → Next, you design a Commvault-to-Azure Blob setup and troubleshoot it in a simulated lab.

Further reading: Azure MARS agent

Want to go deeper into Azure MARS agent? Microsoft’s About the MARS agent and Back up Windows machines with the MARS agent are good next reads, and the full plan for this course is on the Azure Cloud Administration course page.

Scroll to Top

This website uses cookies

We use a few cookies to keep this site working. If you allow it, we also use Google Analytics to count visits so we can improve our lessons. You can accept all, deny the optional ones, or choose what to allow.