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

Community site session details

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

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:
I have the same question (0)
  • Verified answer
    Guero Profile Picture
    64 on at
    Re: Adding Authenticated External Users via Flow/Azure Automation

    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard