Hello Peter,
I understand you're trying to create a Bookings Business using New-MgBookingBusiness
and are running into a 500 Internal Server Error.
This error usually occurs when the signed-in user doesn’t fully meet the API’s requirements. The Microsoft Bookings API only supports delegated access using a work or school account.
Application type permissions and personal Microsoft accounts are not supported:
The user must have a Microsoft 365 license that includes Microsoft Bookings, and the license must be fully provisioned. Even if the license is assigned, the API will fail if provisioning has not completed.
You can verify the license status using:
$me = Get-MgUser -UserId (Get-MgContext).Account
Get-MgUserLicenseDetail -UserId $me.Id | Select-Object -ExpandProperty ServicePlans | Where-Object { $_.ServicePlanName -like "*Bookings*" }
If the ProvisioningStatus
is not Success, that would likely be the cause of the error.
In my test, I removed the -ContextScope Process
parameter and signed in with a user who has a valid license and admin role. The API call returned a successful response:
Connect-MgGraph -Scopes "Bookings.Manage.All", "Bookings.Read.All", "Bookings.ReadWrite.All", "BookingsAppointment.ReadWrite.All"
$params = @{
displayName = "Fourth Coffee"
address = @{
postOfficeBox = "P.O. Box 123"
street = "4567 Main Street"
city = "Buffalo"
state = "NY"
countryOrRegion = "USA"
postalCode = "98052"
}
phone = "206-555-0100"
email = "******@fourthcoffee.com"
#webSiteUrl = "https://www.fourthcoffee.com"
#defaultCurrencyIso = "USD"
}
New-MgBookingBusiness -BodyParameter $params
Let me know if you’re still running into issues or have additional questions.
Hope this helps!
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful, which may help members with similar questions.
If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.