Intune Remediation to verify BitLocker keys are uploaded to Entra ID

Today I want to show you how you can check if the BitLocker Key Backup to Entra ID (AzureAD) was successfully done. We have configured BitLocker encryption in Intune to silently encrypt the system drive and automatically upload the recovery key.

Usually these Settings should ensure, that the device is only encrypted if the Recovery key could be uploaded to Entra ID (aka. AzureAD). Unfortunately, this is only true for the automatic silent encryption or during the client-driven key rotation, but not for manual encryption using manage-bde or the PowerShell equivalent Enable-BitLocker. A quick check using Graph-API to list all uploaded recovery keys showed, that we are missing keys of 5-10% of our devices, as we have devices that were already encrypted using MBAM before we switched to Intune and also some devices were manually decrypted and encrypted during troubleshooting.

To solve this issue, we decided to create a small (proactive) Remediation script in Intune, which checks the local EventLog for the EventID 845 that represents the successful upload to Entra ID:

I uploaded the Remediation script to my GitHub for you to check out: Detection, Remediation

To create the Remediation, simply create it in the Scripts section, give it a name:

Upload the scripts from GitHub and make sure it runs as 64-bit process:

Once the remediation is deployed to a group of devices of your choice, the script will check on a regular basis if the key was uploaded successfully.

I hope this small remediation helps you, to make sure you have the recovery keys for all of your devices stored in Entra ID, so you have it handy once you need it.


Posted

in

by

Comments

4 responses to “Intune Remediation to verify BitLocker keys are uploaded to Entra ID”

  1. Ram Hirani

    Can you update the the remediation script to out error if the it fails to run. currently when it failes on some of the device it does not provide any output

    1. What kind of error message, do you need? The script itself runs within a try catch block, which should output the error message to Stdout.

  2. Derek

    Thanks for posting this guide. Would the detection script work for systems with multiple internal drives?

    1. Currently the detection will only take care of the systemdrive, even if there are mulitple internal drives present. Same for the remediation, it is also hardcoded to use “$env:SystemDrive” to start the key backup. To work with multiple encrypted drives, you need to modify the script to detect and take care of all additional drives

Leave a Reply

Your email address will not be published. Required fields are marked *