<#
.SYNOPSIS
Exports BitLocker recovery keys for all managed Windows devices in the specified tenant to a CSV file.
.DESCRIPTION
This function connects to Microsoft Graph API using the specified tenant ID and scopes, retrieves BitLocker recovery keys for all managed Windows devices in the tenant, and exports them to a CSV file.
.PARAMETER TenantId
The ID of the tenant to connect to. Default value is "oncld.io".
.PARAMETER FilePath
The path of the CSV file to export the BitLocker recovery keys to. Default value is "$home\download\$TenantId-BitlockerKeys.csv".
.EXAMPLE
Export-BitLockerRecoveryKeys -TenantId "contoso.onmicrosoft.com" -FilePath "C:\temp\BitLockerKeys.csv"
This command exports BitLocker recovery keys for all managed Windows devices in the "contoso.onmicrosoft.com" tenant to a CSV file named "BitLockerKeys.csv" in the "C:\temp" directory.
.NOTES
Requires the Microsoft.Graph.Authentication, Microsoft.Graph.Identity.SignIns, Microsoft.Graph.DeviceManagement, and JoinModule modules.
#>
function Export-BitLockerRecoveryKeys {
param (
[string]$TenantId = "xxx.com",
[string]$FilePath = "$home\Downloads\$
Want to know where your tenant stands? Griffin31 checks your Microsoft 365 security settings continuously and shows you what to fix first.