My API call to my SharePoint site returns a 400 Bad Request when querying certain Microsoft 365 groups with the ensureUser API call.
We have a requirement to use Microsoft 365 groups, so I'm trying to figure out why some work and others do not. Please take a look at my examples, and let me know if you can help.
I have created a Microsoft 365 Group:
but calling the ensureUser API call returns a 400 Bad Request:
I believe I have an identical Microsoft 365 Group:
which returns a 200 OK status:
As a sanity check, I created a new Security group:
and confirmed that I can query it:
FYI, none of these groups exist in SharePoint.