Ability to customize Guest invitation emails


Is there a way to customize guest invitation emails, as pr. now a lot of our clients/users sees the invitation as some kind of spam and ignore it. It will help if we can customize the invitasjon to include our branding and customized text..ect

4 Replies
If you have access into AAD you can do so. May require P1, but you can also write a PS1 that executes the 'New-AzureADMSInvitation' CMD and you can do with it whatever you want.
I'll give it a try to see how the emails turn out, tanx mate.

Here's what I came up with.  It is presumed that a request is submitted to the service desk to create an external user with access to a particular sharepoint or other shared resource.  Guest/External user parameters should have already been configured in AAD (i.e. Terms of Use). 


The service desk staff runs the script, which prompts for external user First/Last Names & email address, as well as the UPN/Email of the requestor.  It sends a customized rich-text email invitation to the external user by importing a prepped HTML file, sets the External user Acct's 'manager' field as the requester (for auditing/reporting) and notifies the original requester that the invitation has been sent.  Comments need to be improved, but look for the text in between the < & > values to see what you'll need to provide.

# Collected parameters/variables passed in through script switches.
[string] [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()] $ExUserEmail=$(Throw "Please provide the external user e-mail address."),
[string] [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()] $ExUserLastName=$(Throw "Please provide the external user's Last name."),
[string] [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()] $ExUserFirstName=$(Throw "Please provide the external user's First name."),
[string] [Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()] $Manager=$(Throw "Please provide the e-mail address of the requestor.")

$EmailBody = Get-Content <HTML SOURCE FILE TO BE PLACED IN BODY OF EMAIL-Create Your Own Content> -Raw

# Connect to Azure AD using PW stored in encrypted txt file - Or, use your own credential meethod
$TenantUname = "<USERID@DOMAIN.COM">
$TenantPass = cat "<PATH TO ENCRYPTED PW TXT FILE" | ConvertTo-SecureString
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $TenantUname, $TenantPass
Connect-AzureAD -Credential $Credential

# Send customized guest user email invite
$messageInfo = New-Object Microsoft.Open.MSGraph.Model.InvitedUserMessageInfo
$messageInfo.customizedMessageBody = "Please click on the 'Get Started' link below to setup your Guest Account. This account can be used to login to SharePoint sites that a <COMPANYNAME> employee gives you access to."
New-AzureADMSInvitation -InvitedUserEmailAddress $ExUserEmail -InvitedUserDisplayName $ExUserLastName', '$ExUserFirstName -InviteRedirectUrl <SETUP IN AAD> -InvitedUserMessageInfo $messageInfo -SendInvitationMessage $true

# Set 'Manager' field of guest user account to requester.
$ExUserObjectId = (Get-AzureADUser -Filter "Mail eq '$ExUserEmail'").ObjectID
$ManagerObjectId = (Get-AzureADUser -ObjectId $Manager).ObjectId
$ManagerEmail = (Get-AzureADUser -ObjectId $Manager).Mail

Set-AzureADUserManager -ObjectID $ExUserObjectId -RefObjectId $ManagerObjectId

# Send Notification/Confirmation E-Mail To Requester Letting them know that invitation has been sent.
#$bodyText = $body | convertTo-HTML | Out-String
#Sending the email to the requestor/manager.
Send-MailMessage -From '<FROMADDRESS@DOMAIN.COM' -To "$ManagerEmail" -Subject "CONFIRMATION: The External User Account You Requested Has Been Created." -BodyAsHTML -body $EmailBody -smtpserver <>

best response confirmed by Jimmy Hang (Contributor)

Re-reading your request, my solution isn't quite what you're wanting, but I think if you specify something clear/obvious in the subject as well as the 'From' address it should get you where you need to be and minimize any spam/junk problems.  

Also, this is what gets sent to the users who request an external acct be created:




The Office 365 External User Account that you requested has been created, and an invitation has been sent to the email address you provided.


  • Once they have received the Invitation E-Mail, they must accept the invitation by clicking the 'Get Started' link in the e-mail.


  • You may wish to reach out to them personally to confirm they received and have accepted the invitation.


  • Further, you have been designated as the Manager for this account, and will be periodically contacted to see if the user still requires access.


  • If/When the user no longer requires access, please submit a service desk ticket to have the account removed.


  • You will receive a separate confirmation from the Remedy System when your incident/request ticket has been closed.


Please contact the Service Desk if you require assistance.


Do not reply to this email, as it was automatically generated and sent from an unmonitored address.


Thank you.