Receiving an error when trying to backup bitlocker key to Azure AD with PowerShell

Publish date: 2024-05-17

We are trying to create a script within our environment to upload bitlocker keys to Azure AD using powershell and BackupToAAD-BitLockerKeyProtector

But we receive an error message on all PCs we have tried so far, error message:

BackupToAAD-BitLockerKeyProtector : JSON value not found. (Exception from HRESULT: 0x83750009) At line:1 char:1 + BackupToAAD-BitLockerKeyProtector -MountPoint $env:SystemDrive -KeyPr ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,BackupToAAD-BitLockerKeyProtector 

I have tried the following and multiple other scripts:

BackupToAAD-BitLockerKeyProtector -MountPoint $env:SystemDrive -KeyProtectorId ((Get-BitLockerVolume -MountPoint $env:SystemDrive ).KeyProtector | where {$_.KeyProtectorType -eq "RecoveryPassword" }).KeyProtectorId 

When checking with (Get-BitLockerVolume -MountPoint $env:SystemDrive ).KeyProtector it does output a KeyRrotectorID and RecoveryPassword.

Do anyone have any idea what's going on, or why it's not working? Any help would be very much appreciated.

1 Answer

I Tried to reproduce the same in my environment to backup bit locker key to Azure AD with PowerShell

You can use below PowerShell script to backup Bit locker key to Azure AD with PowerShell.

Connect-AzureAD $BitlockerVol = Get-BitLockerVolume -MountPoint $env:SystemDrive $BPID="" foreach($BP in $BitlockerVol.KeyProtector){ if($BP.KeyProtectorType -eq "RecoveryPassword"){ $BPID=$BP.KeyProtectorId break; } } BackupToAAD-BitLockerKeyProtector -MountPoint "$($env:SystemDrive)" -KeyProtectorId ((Get-BitLockerVolume -MountPoint $env:SystemDrive ).KeyProtector | where {$_.KeyProtectorType -eq "RecoveryPassword" }).KeyProtectorId 

Once ran the above PowerShell code, it got executed successfully.

enter image description here

To check the Bit locker Keys in Azure AD,

Go to Azure Active Directory > Devices > All devices >Search your Device >BitLocker keys (Preview) > Show Recovery Key.

enter image description here

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobm5uYWp%2FdHyOq5ycnZmrtq%2BzjJqlZp2ip7yzedahnKdlpKfGqrrGZquoZZKWsKzBz2aZoqycpLCssdFmop6xXam8bq3ZrqmeZZGZeri106Fkqaenmr%2B0tMQ%3D