Every so often I run into on of those WTF MS moments. Yesterday was one of those days.
I was working on a simple Power Automate flow to get the count of members in Entra security groups. That shouldn’t be a difficult task. Most of what you need is built in with the Office 365 Groups connectors. The only issue is that there isn’t a way to change the URL in the members connector to include the necessary parameters and header to get a count.
No problem, just use the “Send an HTTP request V2” connector, right… Well, yes, but also WTF.
I like to use Graph Explorer to model and test the calls before moving to Automate. Mostly because it’s quicker that way, but also because debugging in Automate is a hot mess.
Here’s the issue. In Graph Explorer the call I needed is https://graph.microsoft.com/v1.0/groups/{groupID}/members?$count=true, but for reasons that I don’t understand at all when you use “Send an HTTP request V2” you need to remove the {} and provide the naked groupID like this https://graph.microsoft.com/v1.0/groups/groupID/members?$count=true.
That totally makes sense… right?
Also, since I mentioned the header thing. To use count=true, you need to add a header value “ConsistencyLevel: eventual” as well. That’s a small thing that we pretty obvious in Graph Explorer, so no WTF there :).