cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NateHutch365
New Member

Automatically invite external user to Azure AD and then add the user to the Visitor default group

I know there are similar posts detailing this but none so far have been quite what I am looking for, I am 100% new to Power Automate and a client requirement has brought me here. 

 

My end goal is to have a webhook to a wordpress site which will send user registration info to Power Automate via HTTP request however, I am trying to start small and have opted for the MS Forms option initially until I've found my feet with Power Automate.

 

From what I have read online just having an external user fill in a MS Form and then that info be used to add the user to the SharePoint site is not possible because the user account must exist in Azure Active Directory first, I have confirmed the basic flow in this scenario fails, flow below

NateHutch365_0-1647461264826.png

 

What do I need to do, in detail, to facilitate my current requirements which I think are

 

  • External user fills form in whereby email address and first/last name are captured
  • User is added as a guest to Azure AD (I think this is the requirement before they can be added to the SharePoint site?)
  • User is then added to the 'Visitors' default group on the site

Some links to the content I have been viewing but am struggling to make heads or tails of which bits I actually need to keep the flow as simple as possible.

 

How to invite external users to a SharePoint site or Microsoft Team using Power Automate & Graph API - This seemed a good place to start but quickly went over my head with the adaptive cards stuff, I don't require an approval process, if the user signs up to the form I want them to be added to the site.

Add External users to Azure AD Using Power Automate (ignatiuz.com) - This seems pretty close to the start of my actual end goal (via webhook) but I can't seem to figure out where/how in this flow it manages to an external users name and email address and also could the starting HTTP request be replaced with the MS Forms 'When a new response submitted' action?

Solved: Automating SharePoint Online access for External U... - Power Platform Community (microsoft.... - Again this is similar but like all of the other posts I come across it requires a list on the site with someone manually adding info and then an approval process which I don't want.

 

Any PA gods/goddess's out there that can help it would be hugely appreciated 

 

Thanks

 

Nate

2 REPLIES 2
Expiscornovus
Super User
Super User

Hi @NateHutch365,

 

That second example is pretty useful, that one is using the Graph API to create an invitation. Using that sample you could try something like below.

 

Keep in mind that your registered application in Azure AD needs the following permissions: User.Invite.All, User.ReadWrite.All, Directory.ReadWrite.All

 

The RedirectUrl will be the site you want to redirect them to.  

 

createinvitation.png

 

After that you can collect the UPN of the user via its id. You can use that UPN to concat the LoginName via an expression. That value can be used to add the user to the Visitors group. In my example that is the sitegroup with id 4.

 

addtovisitorsgroup.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi Expiscornovus,

 

Thanks for this I will try this out and let you know how I get on!

 

Thanks

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,531)