mgbookingbusiness command returns error when using graph bookings application scopes.

Copper Contributor

using microrsoft.graph.bookings pwsh module connected to azure ad app with application scopes:

-bookings.appointment.readwrite.all

-bookings.read.all  

 

tried to retrieve list of calendars and get the following error: 

 

PS C:\Users\fwagg> get-mgbookingbusiness
Get-MgBookingBusiness_List1: An error has occurred.

 

Tried also using delegated rights by using devicebased authentication and specifying the scopes in the connect-mggraph command line. 

- Bookings.Manage.All,

- Bookings.Read.All,

- Bookings.ReadWrite.All, 

 - BookingsAppointment.ReadWrite.All

 

Can retrieve list of calendars via get-mgbookingbusiness but as soon as I try and use the -bookingbusinessid parameter i get the following error:

 

PS C:\Users\fwagg> get-mgbookingbusiness -BookingBusinessId email address removed for privacy reasons
Get-MgBookingBusiness_Get1: Access is denied. Check credentials and try again., Cannot find row based on condition.

 

Should note that mgprofile set to v1.0 and not Beta. Have tried by setting profile to Beta and get same errors. 

 

Trying to use the graph api route to get round issue adding a user to a calendar. 

 

Is anyone experiencing similar issues??

1 Reply

Same issue for me. I was able to make this work. The first part uses Delegated permissions, the second part uses Application permissions.

 

# Use Delegated Permissions ------------
Connect-MgGraph -UseDeviceAuthentication -Scope "Bookings.Read.All"
Select-MgProfile -Name v1.0

$bookingBusinessList = Get-MgBookingBusiness -All

Disconnect-MgGraph


# Use Applications Permissions ---------
Connect-MgGraph -TenantId $TenantID -ClientId $AppID -CertificateThumbprint $certThumb
Select-MgProfile -Name v1.0

foreach($bbl in $bookingBusinessList) {
  $bbl.Id
  $bookingBusiness = Get-MgBookingBusiness -BookingBusinessId $bbl.Id
  $bookingBusiness | FL
}

Disconnect-MgGraph