top of page
  • Writer's pictureSofia Ng

Automate Word templates with data from Azure AD

Why would you use a template to create your documents? Two of the most compelling reasons for using templates for populating documents is the consistent design as well as ensuring placeholder data is populated.

To power up these templates we can use Power Automate with the ability to use Dataverse or SharePoint etc as a source of data.


Lets presume we have an HR form which needs to be populated for a transfer, the document as specific fields which need to be populated along with a specific location in SharePoint where the information needs to be saved. Information such as current role, manager etc is already available in Azure AD.

Lets walk through how we can achieve this

1. First lets create a blank list in SharePoint which will hold our data.

To this list we will add a person column, this column will be used for the individual the form is for.

We will add an effective date column as well, we will also add Manager and Job title. These will be plain text fields and will be populated by the process. You should be left with a list which looks like the following

Click New to bring up the default form

There is a small icon in the top right corner, click the drop down and select Customize with Power Apps

Now we have the ability to supercharge our form. We can hide fields and add meaningful explanations

The first thing we do is change the settings to be Landscape as we want the form to be linked to and take up more space.

Hide the Manager, Job title and Attachment for now.

We will also set a background image to make the form more appealing.

Shameless plug with our beautiful logo :)

Now that we have setup the form it is time to work on the automation.

Navigate to and select your solution - if you do not have a solution pop on over to our bog area and take a look.

Create a cloud flow using a SharePoint trigger

Select the newly created list and add the Azure AD action Get User. As we have used a drop down to select our person in the list the Individual field contains all that we need to query Azure AD.

Test the flow by adding an entry to the form and take a look at the output

Using sample data

We will then add an action to get the manager of our user, pass the UPN from the previous action to filter the results.

Test the results to confirm we can fetch the manager

Now that we have all the parts we need to populate the form it is time to populate the template.

Add an action to Populate a word document, select the location where your template is stored.

Populate the Content Controls we can now see with the data retrieved from our actions.

Then we need to create a SharePoint file using the newly populated template

Now lets do anther test

Let's check out our new document

We have created a quick flow to populate a template with information from Azure. The use cases for this type of automation is wide and can help create more consistent output.

Happy automating!

bottom of page