Power Platform / Azure – Power Automate – Guest user management – Part – 1 – Adding guest user to Azure AD using Microsoft GRAPH Rest API

Power Automate to add guest user to Azure aD
Power Automate to add guest user to Azure aD

Hi All,

Greetings for the day πŸ™‚ LIFE IS BEAUTIFUL πŸ™‚ I hope we all are safe πŸ™‚  STAY SAFE, STAY HEALTHY πŸ™‚

For couple of articles we will discuss – How to automate guest user management through Power Automate and Microsoft Graph API rest service

In this article we will discuss how to add guest user to Azure AD

Background / Use Case

  • We need to add guest user to Azure AD when Power Apps form is submitted. This is basically we can do from the portal as well but since we need to delegate this task to the users to whom we don’t want to give access to Azure AD and so the requirement πŸ™‚
  • We are reading guest user details like – Email Address, Display Name (First Name or Last Name)

Take Away from this article:

  • Power App form for reading guest user details – Email Address, Display Name
  • Power Automate to add respective guest user to Azure AD if user is not already exists
  • Microsoft Graph REST API for adding guest user to Azure AD
  • How to use HTTP connector
  • Calling REST API using HTTP connector from Power Automate

Details:

Power App Form :

Power Platform / Azure - Power Automate - Adding guest user to Azure AD - Power App form to get the guest user details
Fig: Power Platform / Azure – Power Automate – Adding guest user to Azure AD – Power App form to get the guest user details
  • Above is the simple Power App form which reads the guest user details – Basically in Power Automate we need => Guest user Email and Display Name
  • On “Save” button click we trigger the Power Automate, which add the guest user to the Azure AD if already not exists
  • Following is the formula on “Save” button “OnSelect” action
'PowerApp->GuestUserEmail'.Run(txtEmail.Text,txtFirstName.Text,txtLastName.Text)
Power Platform / Azure - Power Automate - Adding guest user to Azure AD - Power App form  - Associating the Power Automate to the "Save" button
Fig: Power Platform / Azure – Power Automate – Adding guest user to Azure AD – Power App form – Associating the Power Automate to the “Save” button

Power Automate :

  • Power Automate is also very simple. Accepts three parameters and trigger HTTP request to add respective guest user to Azure AD
  • Complete Power Automate snap :
Power Platform / Azure - Power Automate - Adding guest user to Azure AD - Complete Power Automate

Fig: Power Platform / Azure – Power Automate – Adding guest user to Azure AD – Complete Power Automate

HTTP connector :

Power Platform / Azure - Power Automate - HTTP premium connector
Fig: Power Platform / Azure – Power Automate – HTTP premium connector
  • HTTP connector is available with premium license
  • Once we have added HTTP connector we need to provide following required details :
    • Method = > POST, GET, DELETE, PUT, PATCH
    • URI => REST call which we need to invoke => here in our case to add guest user in Azure AD => https://graph.microsoft.com/v1.0/invitations
    • Authentication mechanism => None, BASIC, Client Certificate, Raw, Active Directory OAuth
  • Since we are calling Microsoft Graph Rest API, we are using Active Directory OAuth
  • For using Microsoft Graph Rest API and Active Directory OAuth authentication we need to provide following details
    • Tenant => Our tenant id
    • Audience => Our Microsoft Graph URL => https://graph.microsoft.com
    • Client Id => Our custom Azure App ID
    • Credential Type => Either client secret key or certificate
    • Secret => Secret key for our Azure Client App
Power Platform / Azure - Power Automate - HTTP connector - Calling Microsoft Graph Rest API to add guest user to Azure AD
Fig: Power Platform / Azure – Power Automate – HTTP connector – Calling Microsoft Graph Rest API to add guest user to Azure AD

Next Article : In next article we will discuss how to add external / guest user to specific Group

We have very good series Microsoft Graph please have a look – https://knowledge-junction.com/?s=Microsoft+Graph

We have very good series on Power Automate – https://knowledge-junction.com/?s=power+automate OR https://knowledge-junction.com/?s=power+platform

We have very good in depth series on Azure App and Azure Active Directory – https://knowledge-junction.com/?s=Azure+App OR https://knowledge-junction.com/?s=Azure+Active+Directory

Thanks for reading πŸ™‚ If its worth at least reading once, kindly please like and share. SHARING IS CARING πŸ™‚

Share In Teams:

Enjoy the beautiful life πŸ™‚ Have a FUN πŸ™‚ HAVE A SAFE LIFE πŸ™‚ TAKE CARE πŸ™‚

Prasham Sabadra

LIFE IS VERY BEAUTIFUL :) ENJOY THE WHOLE JOURNEY :) Founder of Knowledge Junction and live-beautiful-life.com, Author, Learner, Passionate Techie, avid reader. Certified Professional Workshop Facilitator / Public Speaker. Scrum Foundation Professional certificated. Motivational, Behavioral , Technical speaker. Speaks in various events including SharePoint Saturdays, Boot camps, Collages / Schools, local chapter. Can reach me for Microsoft 365, Azure, DevOps, SharePoint, Teams, Power Platform, JavaScript.

You may also like...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: