How it works: Backup and restore for Microsoft Authenticator

Hello! With the dust settling from Ignite 2019, let's dive in with “how stuff works” – focusing on the Microsoft Authenticator's backup and restore feature.

Earlier this year we released the Microsoft Authenticator backup and restore feature on iOS and Android, which lets you easily move your accounts on the Authenticator app to a new device. Some folks have asked how we secure this process – in this blog, we'll deep dive into how it works.

In the descriptions below, a “strong token” means the user has authenticated using multi factor – for example, they used a password and then entered a code sent to their phone or email or signed in with Windows Hello or a FIDO token, depending on the factors they have previously enabled.

Overview of how the Microsoft Authenticator works

The Microsoft Authenticator supports a variety of mechanisms to support Microsoft consumer, work and school accounts in different modes, as well as any account which supports the OATH TOTP standard.

For accounts using the OATH TOTP standard, there is a shared secret stored both in the Authenticator app and in the identity provider.

For accounts using other mechanisms, the Authenticator creates a public/private keypair in a hardware backed (e.g. the Keychain on iOS and Keystore on Android) and exports the public key to Microsoft's login server. The private key never leaves the device when a user is using the backup or restore features of their Authenticator app or when using the operating system app restore features.


To restore Microsoft Authenticator accounts on a new device, the user must first back up their current device. Here are the steps.

  1. The user starts the backup process by clicking on the menu, going to settings, and enabling backup.
  2. The Authenticator app uses a strong authentication token to request a 256-bit key from an internal Microsoft account key service. The app receives this key and a retrieval id (Key ID) from the key service.
  3. The Authenticator uses the key to create an JSON Web Encryption blob (JWE) using AES-256 The information contained varies based on what accounts the Authenticator's owner has configured.
    1. For all accounts, the Authenticator encrypts relevant metadata about the account such as:
      1. Backup creation time
      2. Account system
      3. Username
      4. Credential types (e.g. Phone Sign-In, TOTP)
    2. For OATH TOTP accounts (including personal Microsoft account and third party), the JWE also includes the shared secret used in TOTP.
    3. The data above is also hashed with SHA-512 to protect against theft and tampering and this hash is added to the JWE.
  1. The JWE and the Key ID are then uploaded to the appropriate cloud :
    1. For Android devices, they are stored in Microsoft's cloud provider and tied to the user's personal Microsoft account.
    2. For iOS devices, they are stored in iCloud and tied to the user's Apple account.


After the backup has been successfully created, the user can restore their Microsoft Authenticator accounts on a new device. Here are the steps:

  1. The user starts the process by clicking on “Begin ” on the home screen of the app.
  2. The user is required to sign into the account they used to create the backup in step 2 after which the app retrieves the JWE and key ID stored in step 4 from the appropriate cloud storage – Microsoft's cloud storage provider (Android devices) or iCloud (iOS devices).
  3. The Authenticator app uses a strong authentication token and the Key ID to retrieve the key from the Microsoft account key service.
  4. Using the key, the Authenticator decrypts the JWE and verifies its integrity using the hash from step 3c.
  5. The contents of the accounts stored in the JWE are used to populate the application, and the user can see their accounts in the app.
    1. OATH TOTP accounts (from 3b) are fully setup as the shared secret has been restored.
    2. For all other accounts displayed, the user must authenticate to create a new public/private keypair on the device and re-register each account's public key for the new Authenticator instance.

Backup and Recovery Diagram

What's life without a little UML? Here's a picture encapsulating the flow described above.

Auth Backup and Restore.PNG


Hopefully this helps you understand the mechanics behind our secure backup and restore process for Microsoft Authenticator. If you have any more questions, check out our Microsoft Authenticator docs or ping me at @alex_t_weinert.

Stay safe out there!
– Alex


This article was originally published by Microsoft's Azure Blog. You can find the original article here.