SYNOPSIS
Invokes the backup of BitLocker recovery keys to Intune for all Intune managed devices.SYNTAX
DESCRIPTION
This script connects to Microsoft Intune and retrieves BitLocker recovery keys from all devices managed by Intune. It requires the Microsoft Graph PowerShell SDK to be installed and appropriate permissions to access device management and BitLocker key data.EXAMPLES
EXAMPLE 1
EXAMPLE 2
EXAMPLE 3
EXAMPLE 4
EXAMPLE 5
EXAMPLE 6
PARAMETERS
-IncludeDeviceInfo
Switch to include device information such as device name, OS, compliance status, etc.-IncludeDeviceOwner
Switch to include device owner information (UPN). Requires IncludeDeviceInfo parameter.-ExportToExcel
Switch to export the results to an Excel file in the user profile directory. If not specified, the function returns the data objects.-RevealKeys
Switch to display BitLocker recovery keys in plain text format in the CSV export. WARNING: This will expose sensitive BitLocker recovery keys in the output file! Use only when necessary and ensure secure storage of the exported file.-BackupToKeyVault
Specify the name of Azure Key Vault to backup BitLocker recovery keys. Requires Azure PowerShell module and appropriate permissions to access Key Vault. Keys will be stored with device name and BitLocker key ID as the secret name. Example: -BackupToKeyVault “MyBitLockerVault”-DeviceName
Filter results to a specific device by its display name. Cannot be used together with DeviceID parameter. Example: -DeviceName “LAPTOP-ABC123”-DeviceID
Filter results to a specific device by its device ID (GUID). Cannot be used together with DeviceName parameter. Example: -DeviceID “12345678-1234-1234-1234-123456789abc”CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.INPUTS
OUTPUTS
NOTES
Author: Bastien Perez (adapted from Vasil Michev) Source: https://github.com/michevnew/PowerShell/blob/master/GraphSDK_Bitlocker_report.ps1 The script requires the following Microsoft Graph permissions:- BitLockerKey.Read.All (required) - Allows the app to read BitLocker keys on behalf of the signed-in user, for their owned devices. Allows read of the recovery key.
- Device.Read.All (optional) - Needed to retrieve device details like name, OS, compliance status
- User.ReadBasic.All (optional) - Needed to retrieve device owner UPN information
- User context: Can only read BitLocker keys for devices owned by the signed-in user (if you have admin permissions, you can read all devices and all bitlocker keys)
- Application context: Can read BitLocker keys for all devices in the organization (requires admin consent)
- Managed Identity: Same as application context when properly configured with admin consent