Comment
Databricks Partner

 

Thank you for this guide. Just one small issue that is in the guide I ran into. You need to add the API MS Graph permissions also for Group.Read.all and get a consent for it, otherwise you will get an error in the script in line 58 (group = self.graph.getGroupByName(toplevelgroup))

The error is not very clear, but when I printed the group (print("Group" + str(group)) there was an error regarding insufficient permissions:
{'error': {'code': 'Authorization_RequestDenied', 'message': 'Insufficient privileges  to complete the operation.', 'innerError': {'date': '9999-99-99T00:00:00', 'request-id': '00000000-0000-0000-0000-000000000000', 'client-request-id': '00000000-0000-0000-0000-000000000000'}}}

After adding the correct API permissions, it now works.