In this blog post we are going to cover the aspects of inviting a new user or an external user to Azure Ad and on board to the Customer Portal.
With this feature you can
- Add external user to the Azure AD.
- Add external user to the Customer portal.
- Send invitation emails to the end user on provisioning of a Customer portal.
Setup Site Settings in the Customer portal
In the Customer portal setting, set site setting AllowContactMappingWithEmail value to true. This allows a staff member to register on the portal using Azure AD and be connected to an existing contact record.
Create Entity to Track Request
We will have custom entity called UserOnBoardingRequest entity with fields first name, last name, Email Address and Invite Status.
Invite status is an option set with values Queued, Pending Acceptance, Accepted or Rejected Status.
We will have form in PowerApps Portal to add record for UserOnBoardingRequest, this would be the entity to keep track of users that are added through the portal,
For Onboarding user to Azure AD tenant we need to setup or create below flows.
- Triggered flow “When a User On Boarding Record is updated -> Send User Invitation”
- Scheduled or Recurrence flow “Recurrence Pending Acceptance Check -> List records”
Flow 1 “When a User On Boarding Record is updated -> Send User Invitation”
Flow gets triggered if the invitation status gets updated and set to Queued status. Flow performs below
- Check if user exists and Provisioned, Update the request status to Accepted state.
- If User does not exist or guest invitation rejected state, flow sends out Invitation request
Configure a New flow with CDS Update Triggered flow for UserOnBoardingRequest entity on invitation status change field as below.
We need to check if the user already exists, for this we need to Create a http request action to check if user exists as below
This is a graph call with parameter or filter as email address, this will return User information if exists.
If user information is returned, check the exteranlUserState response value to see if user accepted the Guest invite, if yes update the request to the Acceptance state. End the flow
If not send invite to the guest user email address using httprequest action in the flow as below
While calling the invitation action, we are passing the display name which is combination of first and last name, email address and redirect url as well.
Post the successful invite send Update the status of the request to PendingAcceptance.
Flow 2 “Recurrence Pending Acceptance Check -> List records”
Flow frequently checks for all request that are in pending acceptance status, for each of the request that are in pending status it would perform Micrsoft graph api call to check if user is Accepted or Rejected state. Accordingly the request is updated to the Accepted or Rejected state.
Create a Recurrence or Scheduled flow as below
Fetch all the request that are in pending acceptance check ,
for each of the request check the status of guest invite status by performing graph call.
Check the response of the flow externalUserState if state is Accepted or Rejected accordingly update the user on boarding request with the Accepted or Rejected state.
Create a contact record with the first name,last name and email address to provision user for customer portal
We will have form in PowerApps Portal to add record for User OnBoardingRequest
- Existing or admin User will create a UserOnBoardingRequest record by filling up first name, last name and email address.
- User clicks submit. On click of submit the record will be created with Invite Status will be set to Queued.
“When a User On Boarding Record is updated -> Send User Invitation” will get executed, guest invite email will be sent to the email address.
New user will accept the guest invite with mentioned email address.
Recurrence flow will check for the user Acceptance, if Accepted user will be provisioned to the Customer Portal as well.