web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Adding Authenticated E...
Power Automate
Answered

Adding Authenticated External Users via Flow/Azure Automation

(0) ShareShare
ReportReport
Posted on by 64

Hi there, I'm quite new to SharePoint/Azure/Powershell, so I'm not sure if I'm best off posting this here or on the Powershell/SharePoint community forums, apologies if that's the case.

 

We currently have client SharePoint sites hosted on our O365 tenant, with access to each site to be rolled out to each of our respective clients shortly. Initially, only the senior management of each client will have access to the sites, however as time goes on it's likely we'll be adding everyone else too. As we're a small company, to streamline the new user process and save us having to add each and every individual staff member, we've been considering using a Flow to automate user access instead, with the goal of adding authenticated external users without much real input from administrators other than a simple approval/rejection process.

 

The flow as follows:Flow 1.png

Flow 2.png

Flow 3.png

The plan is as follows:

  1. Each Client site has a SharePoint Custom List, titled "Employee Access List". Said list will have the following columns: Request ID (Text), First Name (Text), Last Name (Text), Job Title (Text), Company (Text), Contact Number (Text), E-Mail (Text), SharePoint Access (Yes/No Boolean).
  2. If a member of staff requires access to the SharePoint site, then their respective manager will add the staff member to the list and fill in all the above fields, setting the "SharePoint Access" item value to "Yes".
  3. This will trigger an approval email to be sent to myself and another administrator, with said email detailing the user to be created, and who has submitted the request.
  4. Script insertion somehow - This would then run if the request was approved, and set the user up with access.
  5. Email notification is then sent to the creator of SharePoint list item, notifying them that the user now has access.

 

Step 4 is where I'm a little unsure in regards to what to do if the request is approved - I've written a little Powershell script below which nearly achieves what I'm going for, in that it creates an external user PnP Group and PnP Role Definition (If there isn't one already), pulls what's in the "E-mail" fields on the "Employee Access" list and runs Add-PnPUsertoGroup to pull the users to the PnP group, which then sends the users an email with a link to the SharePoint site, allowing them to access it. However:

  • The script targets everyone on the SharePoint List, whereas ideally I would just want the script to run for the person that's been newly added to the list and is listed in the approval email, and only them. I'm not sure how I'd achieve this...
  • Though I don't know much about them, I've heard Azure Functions and Azure Automation can be used to insert my script into the flow - I'm leaning towards the latter, however, as I say, I have no idea how to actually pipe what's in the flow into script. Is Azure Automation the right way to go about this, or is Functions more suitable, or some other alternative?

 

Script as follows:Script.png

 

Any guidance would be appreciated, and please let me know if any other details are required.

Thank you!

Categories:
  • Verified answer
    Guero Profile Picture
    64 on at

    Hi all,

     

    Please disregard this duplicate thread, question has been answered here:

     

    https://powerusers.microsoft.com/t5/Building-Flows/Automating-SharePoint-Online-access-for-External-Users/m-p/295173

     

    Thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 292 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 128

Last 30 days Overall leaderboard