The Remove-MgBookingBusinessCustomer cmdlet is used to delete a specific customer record from a Microsoft Bookings business within Microsoft 365. When a customer’s information becomes outdated, or they no longer require your services, this cmdlet allows administrators to remove their data programmatically and maintain a clean customer directory.
Try the M365Corner Microsoft 365 Reporting Tool — your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams.
Administrators use this cmdlet to:
Using PowerShell to remove customers ensures faster, more controlled, and repeatable data management for Bookings administrators.
Before using this cmdlet, ensure you:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Bookings.ReadWrite.All"
To delete a customer from a Microsoft Bookings business, provide both the BookingBusinessId (the business identifier, typically its email address) and the BookingCustomerBaseId (the unique ID of the customer).
Remove-MgBookingBusinessCustomer -BookingBusinessId <String> -BookingCustomerBaseId <String>
This example removes one customer from a specific Microsoft Bookings business.
$bookingBusinessId = "ContosoENTClinic@7xh7fj.onmicrosoft.com"
$customerId = "12345678-abcd-1234-efgh-56789abcdefg"
Remove-MgBookingBusinessCustomer -BookingBusinessId $bookingBusinessId -BookingCustomerBaseId $customerId
This command deletes the customer record associated with $customerId from the booking business identified by $bookingBusinessId.
You can remove several customers by iterating through a list of customer IDs.
$bookingBusinessId = "ContosoENTClinic@7xh7fj.onmicrosoft.com"
$customerIds = @("12345678-abcd-1234-efgh-56789abcdefg", "22345678-abcd-2234-efgh-66789abcdefg")
foreach ($customerId in $customerIds) {
Remove-MgBookingBusinessCustomer -BookingBusinessId $bookingBusinessId -BookingCustomerBaseId $customerId
}
This loop iterates through the $customerIds array and removes each customer from the specified booking business. It’s ideal for semi-bulk removal where you only need to remove a few specific customers.
For large-scale customer cleanup, you can use a CSV file containing all the customer IDs to remove.
CSV File Format:
CustomerId
12345678-abcd-1234-efgh-56789abcdefg
22345678-abcd-2234-efgh-66789abcdefg
32345678-abcd-3234-efgh-76789abcdefg
PowerShell Script:
$bookingBusinessId = "ContosoENTClinic@7xh7fj.onmicrosoft.com"
$csvPath = "C:\path\to\customers.csv"
$customers = Import-Csv -Path $csvPath
foreach ($customer in $customers) {
Remove-MgBookingBusinessCustomer -BookingBusinessId $bookingBusinessId -BookingCustomerBaseId $customer.CustomerId
}
This script imports customer IDs from a CSV file and removes each corresponding record from the specified booking business. This method is particularly effective for tenant-wide cleanup tasks.
| Key Point | Details |
| Cmdlet Name | Remove-MgBookingBusinessCustomer |
| Purpose | Deletes a customer record from a Microsoft Bookings business |
| Required Scope | Bookings.ReadWrite.All |
| Primary Parameters | BookingBusinessId, BookingCustomerBaseId |
| Automation Benefit | Enables streamlined deletion of customer data via automation |
| Use Case | Ideal for offboarding, customer data cleanup, and bulk removals |
Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.
Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.
© Your Site Name. All Rights Reserved. Design by HTML Codex