Power Apps Azure AD Group

In this Power Apps Tutorial, We will discuss what is Azure AD in PowerApps, What are the various issues and limitations in Power Apps Azure.

Also, We will see what are the actions that you can use for PowerApps Azure AD. By taking a simple scenario, We will discuss how we can get the azure groups in PowerApps using PowerApps Azure AD Connectors.

And also, We will cover these below topics:

  • How to get azure group members in PowerApps
  • Get azure ad user in PowerApps
  • Power Apps Azure AD get user information (Job Title and Location)
  • PowerApps check if user is in Azure ad group or PowerApps Filter and check users belong to Azure Ad Group

PowerApps Azure AD

  • Microsoft Azure Active Directory (Azure AD) is a cloud based identity and access management service.
  • Azure AD helps to employees sign in and access resources in external resources. To work with the Azure AD connector, some administrator permissions required. Such as:
  1. Group.ReadWrite.All
  2. User.ReadWrite.All
  3. Directory.ReadWrite.All

Various issues and limitations in PowerApps Azure AD

There are some issues and as well some limitations in PowerApps Azure AD. Such as:

  1. The connector does not support Mail-Enabled Security groups.
  2. AAD groups with the attribute “isAssignableToRole” are not supported for now.
  3. The connector does not return custom attributes of Azure AD entities.

Read Upload PowerApps Attachments to SharePoint Library Folder

PowerApps Azure AD Actions

The below table represents some of the important actions that are present in the PowerApps Azure AD Actions.

ActionsDescription
Add user to groupIt helps to add a user to a group in this AAD tenant.
Assign managerIt helps to assign a manager for a user.
Check group membership (V2)It specifies if the user is a member of the given group, then the result will contain the given id. Otherwise, the result will be empty.
Check group membership [DEPRECATED]Here this action has been deprecated. Please use Check group membership (V2) instead.
Create groupThis action helps to create a group in your AAD tenant.
Create Office 365 groupThis action helps to create an Office 365 group in your AAD tenant.
Create security groupThis action helps to create a security group in your AAD tenant.
Create userThis action helps to create a new user in your AAD tenant.
Get groupIt helps to retrieve the details for a group.
Get group membersIt helps to get the users who are members of a group.
Get groups of a user (V2)It helps to get the groups a user is a member of.
Get groups of a user [DEPRECATED]This action has been deprecated. Please use Get groups of a user (V2) instead.
Get userIt helps to retrieve all the details for a user.
Refresh tokensIt helps to invalidate all refresh tokens for a user
Remove Member From GroupIt helps to remove Member From Group
Update userIt helps to update the info for a user.

Connect Azure AD Connector in PowerApps

Now we will see how to connect the Azure AD connector in Power Apps.

  • As we discussed, whenever you are creating the Azure AD app, you must need to connect the Azure AD connector to the PowerApps.
  • To connect the Azure AD in the app, go to the Data tab (from the left navigation pane) -> + Add data -> Search Azure AD in the search box as shown below.
Power Apps Azure AD group
PowerApps Azure AD
  • Click on the Azure AD connector and then tap the Connect button. Once you will click on it, then the Azure connector will connect to the app. Without an Azure AD connector, it is not possible to work with Azure related things in the app. Now the connector is ready to use.
PowerApps Azure AD
PowerApps Azure AD

PowerApps Azure AD get all groups

Do you want to retrieve all the Azure AD groups in PowerApps? Check out the below scenario to achieve it easily.

  • The below screenshot represents all the Azure groups that are present in the Azure portal. Now I would like to display all these Azure groups in PowerApps.
PowerApps Azure AD get all groups
PowerApps Azure AD get all groups
  • For this, insert a Combo box control and a Button control to the app. When a user will press the button (named Hit and Get Azure Groups), all the Azure groups will retrieve and display in the combo box control.
  • To achieve this, select the Button (Hit and Get Azure Groups) and apply the below formula on its OnSelect property as:
OnSelect = ClearCollect(
    ColAzureGroups,
    AddColumns(
        AzureAD.GetMemberGroups(
            User().Email,
            false
        ).Value,
        "AzureGroupName",
        AzureAD.GetGroup(Value).displayName
    )
)

Where,

  1. colAzureGroups = Specify a Collection name. Refer to this link to get more information about collection: Power Apps Collection
  2. AddColumns = PowerApps AddColumns function helps to add a column to a table. To know more details about AddColumns function, you can refer to this link: PowerApps AddColumns
  3. AzureGroupName” = Provide a new column name where all the Azure groups will store
PowerApps Azure AD get all groups
  • Next, select the Combo box control and set its Items property to the collection name as:
Items = ColAzureGroups
PowerApps Azure get all groups
PowerApps Azure get all groups
  • After all, you need to specify the new column name (AzureGroupName) in the Combo box’s DisplayFields and SearchFields properties as:
DisplayFields and SearchFields = ["AzureGroupName"]

Refer to the below screenshot.

Power Apps Azure get all groups
  • Now save and preview the app. When the user will hit the Button (Hit and Get Azure Groups), then all the Azure groups will retrieve and display in the combo box control.

This is how we can work with PowerApps Azure AD to get all groups.

PowerApps azure get group members

In this scenario, We will see how to get all the Azure group members in PowerApps.

  • To do this, add a Dropdown control and apply the below code on its Items property as:
Items = AzureAD.GetGroupMembers("af641583-a427-409c-9ca1-8411d4b87a22").value

Where,

af641583-a427-409c-9ca1-8411d4b87a22” = Provide Azure group ID that contains all the group members. You need to specify the group ID within the inverted comma (” “) including the .value

PowerApps azure get group members
  • Save, Preview, and Close the app. Reopen the app again and click on the chevron symbol. You can able to view all the group members of the specific group (the ID that has specified by the user).
PowerApps azure ad get group members
PowerApps azure ad get group members

This is how to work with PowerApps azure get group members.

PowerApps get azure ad user

Do you want to get Azure AD Directory Users or to get Azure active directory users within the canvas app? Go through the below simple scenario.

  • As you can see in the below screenshot, there is a text input control, a Button input, and a Datatable control.
  • A user will enter the Azure Active Directory user ID and press the button (GET). Once the user will press it, it will retrieve all the user details and display in the data table control as shown in the below screenshot.
PowerApps get azure ad user
  • To work around with this, select the button control (GET) and apply the below formula on its OnSelect property as:
OnSelect = ClearCollect(
    colAzureUserDetails,
    AzureAD.GetUser(txtAzureID.Text)
)

Where,

  1. colAzureUserDetails = Specify a collection name
  2. txtAzureID = Provide the text input control name. Here you need to enter the Azure active directory user ID
Power Apps get azure ad user
  • Next, apply the collection name in the Data table’s Items property as:
Items = colAzureUserDetails
  • If you want to view more user details (like id, Profile, Location, etc) in the Data table, then you can add it by using + Add field option as like below.
PowerApps get azure user details
PowerApps get azure user details
  • Save, preview the app and do the performance as per your need. This is how we can work with PowerApps to get azure ad users.

Azure AD get user information (Job Title and Location) in PowerApps

  • In this scenario, I would like to get the user job title and office location and many more information from Azure AD.
  • As we know, in PowerApps, to get the Azure user, We are using Get.User() method. But in some cases you may want to retrieve more user information like user email, user id, user display name, then in that case, you may follow the below formulas.
  • Here in the below screen, I have retrieved two different user information as Job Title and Office Location.
PowerApps Azure AD get user information

PowerApps Azure AD get User Job Title

  • To get the Azure user job title, you can apply the below formula to Label’s Text property as:
Text = "Job Title: " & AzureAD.GetUser(User().Email).jobTitle
  • If you want to get the currently logged-in user information, then you need to specify as User().Email. Otherwise, you can apply the below code:
Text = "Job Title: " & AzureAD.GetUser("User-Email-Address").jobTitle

Refer to the below screenshot.

PowerApps Azure AD get User Job Title

PowerApps Azure AD get User Location

  • To get the Azure user office location, you can apply the below formula to Label’s Text property as:
Text = "Office Location: " & AzureAD.GetUser(User().Email).officeLocation

Refer to the below screenshot.

PowerApps Azure AD get User location
PowerApps Azure AD get User location
  • Not only you can get the user’s Job title and Office location, but also you can try the below parameters to get the user info like:
  1. displayName
  2. givenName
  3. id
  4. mail
  5. mobilePhone
  6. preferredLanguage
  7. surname
  8. userPrincipalName
  9. businessPhones

PowerApps check if user is in Azure ad group

Suppose you want to filter and check the record if the currently logged-in user belongs to a member of a specified Azure Ad group or not, then in that case you can try the below things:

PowerApps check if the user is in the Azure ad group

Also, you may like the below PowerApps Tutorials:

In this Power Apps Tutorial, We discussed what is Azure AD in PowerApps, What are the various issues and limitations in PowerApps Azure.

Also, We saw what are the actions that you can use for PowerApps Azure AD. By taking a simple scenario, We discussed how to get the azure groups in PowerApps using PowerApps Azure AD Connectors.

And also, We covered these below topics:

  • PowerApps get azure group members
  • PowerApps get azure ad user
  • PowerApps Azure AD get user information (Job Title and Location)
  • PowerApps check if user is in Azure ad group or PowerApps Filter and check users belong to Azure Ad Group
  • perfect sir.
    I wonder if there is a straightforward way like this to fetch the group ID using group name – that was pulled earlier using AzureAD.GetMemberGroups – so everything will be automated?

  • >