cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Office365Groups Connector to security group

Hello,

 

I'm using Office365 groups connector to validate the memebership of the loggued user.

But now i have a group created as security group and the list displayed (the blue one on image).

How can I get Security groups of AD with this connector?

Should I use another connection?

I reviewed the documentation about the method and can't see anything wrong.

CarlosAcuna_And_0-1600203592654.png

 

Thanks for your help. Regards

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Anonymous 

Although you can consider the Custom Connector as mentioned by @v-bofeng-msft , this will incur licensing considerations as the custom connectors are consider a premium connection.

However, the steps taken can be done completely with the AzureAD connector now.

 

If you want to get a list of all the security groups that the current user is a member of, then you can utilize this formula:

ClearCollect(colADGroups, AddColumns(AzureAD.GetMemberGroupsV2(User().Email, true).value, "theGroup", AzureAD.GetGroup(Value)))

Note: this particular function is a behavioral function and must be done in a behavioral action.  In this case I am collection the list of groups.  Also, I am adding a column to the collection that will have the actual Group details in it - which is gathered by GetGroup.

At this point, your Gallery (if you were to use one) would have an Items property of colADGroups and you could display the information in a few labels - example ThisItem.theGroup.displayName, etc.

 

If your intention is to just check membership in the group, then you can utilize a formula such as this:

ClearCollect(colADGroups, AddColumns(AzureAD.GetMemberGroupsV2(User().Email, true).value, "groupName", AzureAD.GetGroup(Value).displayName))

(remember: you need to do this in a behavioral action)

Then you can check against that collection for the name of the group you are interested in.

 

Or, perhaps a more elegant solution (since you just want to know membership in that particular security group) - Set a variable:

Set(IamInTheGroup,
    CountRows(
        Filter(
            AddColumns(AzureAD.GetMemberGroupsV2(User().Email, true).value, 
            "groupName", AzureAD.GetGroup(Value).displayName),
            groupName = "yourSecurityGroupName"
        )
    ) > 0
)

 

If the user is in the security group, the IamInTheGroup variable will be true.

 

No additional licenses needed.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@Anonymous 

Take a look at the AzureAD connector.  That should be able to validate against Security groups.

The Office365 connector only deals with the 365 Groups.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
v-bofeng-msft
Community Support
Community Support

Hi @Anonymous :

Could you tell me if you want to get the list of security groups of the current user?

I strongly agree with @RandyHayes .The point is "Office365 groups connector can not get the list of Security groups".

My suggestion is to use Graph and Custom connector to get the security group.I'v made a test for your reference:

Firstly,Using List memberOf

Get https://graph.microsoft.com/v1.0/me/memberOf

Can get all groups the current user belong to(inclould securtiy groups),You can use this URL to test the graph you are going to use.

Seconldy,If you want to use this command, you must call it through a custom connector

Please refer to this link

1.jpg2.JPG

Finally,Get the security group of the current user by filtering the records whose 'securityEnabled' value is true.

For Example:

Add a gallery and set it's Items property to:

Filter(ListAllGroupsInMyOrg.MyGroups().value,securityEnabled)
  • ListAllGroupsInMyOrg is my custom connector
  • MyGroups is my custom Action

3.JPG

Best Regards,

Bof

 

@Anonymous 

Although you can consider the Custom Connector as mentioned by @v-bofeng-msft , this will incur licensing considerations as the custom connectors are consider a premium connection.

However, the steps taken can be done completely with the AzureAD connector now.

 

If you want to get a list of all the security groups that the current user is a member of, then you can utilize this formula:

ClearCollect(colADGroups, AddColumns(AzureAD.GetMemberGroupsV2(User().Email, true).value, "theGroup", AzureAD.GetGroup(Value)))

Note: this particular function is a behavioral function and must be done in a behavioral action.  In this case I am collection the list of groups.  Also, I am adding a column to the collection that will have the actual Group details in it - which is gathered by GetGroup.

At this point, your Gallery (if you were to use one) would have an Items property of colADGroups and you could display the information in a few labels - example ThisItem.theGroup.displayName, etc.

 

If your intention is to just check membership in the group, then you can utilize a formula such as this:

ClearCollect(colADGroups, AddColumns(AzureAD.GetMemberGroupsV2(User().Email, true).value, "groupName", AzureAD.GetGroup(Value).displayName))

(remember: you need to do this in a behavioral action)

Then you can check against that collection for the name of the group you are interested in.

 

Or, perhaps a more elegant solution (since you just want to know membership in that particular security group) - Set a variable:

Set(IamInTheGroup,
    CountRows(
        Filter(
            AddColumns(AzureAD.GetMemberGroupsV2(User().Email, true).value, 
            "groupName", AzureAD.GetGroup(Value).displayName),
            groupName = "yourSecurityGroupName"
        )
    ) > 0
)

 

If the user is in the security group, the IamInTheGroup variable will be true.

 

No additional licenses needed.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,930)