🚀 Migrating Legacy Data into Power Pages with Entra ID Users (Step-by-Step Guide)
🚀 Migrating Legacy Data into Power Pages with Entra ID Users (Step-by-Step Guide)
When building a Power Pages site, one of the most common challenges teams face is migrating historical data into Dataverse while ensuring that records remain linked to the correct users.
In Power Pages, every authenticated user is represented by a Contact record in Dataverse.
However, Contacts are created only when users log in for the first time.
So what happens when:
You are migrating old data
Requests were created by users
And those users have never logged into the new Power Pages site yet?
This blog walks you through a clean, enterprise-grade solution to handle this scenario properly.
🧩 The Problem
You are building a Power Pages site and migrating data from a legacy system into Dataverse.
Each request record:
Was created by a user
Must be linked to a Contact record
Uses Entra ID (Azure AD) for authentication
But:
The Power Pages site is new
Contacts do not exist yet
Users have not logged in yet
Importing requests fails because Contact lookups cannot be resolved
✅ The Correct Architecture (High-Level)
Instead of waiting for users to log in and create Contacts automatically, the right approach is:
Pre-create Contacts in Dataverse from Entra ID users before migrating data.
This ensures:
Historical requests can be linked correctly
No broken lookups
No duplicate users
Seamless login experience later
🏗 Target Design
Entra ID users → Dataverse Contacts
Legacy Requests → Dataverse Request table
Linking key → User Email (UPN)
Power Pages → Maps Entra ID login to Contact using email
🪜 Step-by-Step Implementation
✅ Step 1: Export Users from Entra ID (Azure AD)
Ask your admin to export the following user fields from Entra ID:
First Name
Last Name
Display Name
Email (UPN)
Object ID (optional)
Prepare an Excel file like this:
| Full Name | First Name | Last Name | |
|---|---|---|---|
| John Doe | John | Doe | john@company.com |
✅ Step 2: Import Users into Dataverse Contact Table
Import the Entra ID users into the Contact table using:
Data Import Wizard
Power Automate Dataflow
Excel Import
Map:
Email →
emailaddress1First Name →
firstnameLast Name →
lastnameFull Name →
fullname
✔ Now your Dataverse environment already contains all users as Contacts
✔ No need to wait for first login
✅ Step 3: Configure Power Pages Authentication Mapping
In Power Pages:
Configure Entra ID authentication
Ensure identity mapping uses:
Contact.Email = Entra ID Email (UPN)
This ensures that when a user logs in later:
Power Pages links the login to the existing Contact record
No duplicate Contact is created
✅ Step 4: Prepare Legacy Requests for Import
Prepare your legacy data with a column containing user email:
| Request ID | Title | Requester Email |
|---|---|---|
| 1001 | Solar Installation | john@company.com |
This email will be used to map requests to Contacts.
✅ Step 5: Import Requests with Contact Lookup
Use one of the following methods:
Option A – Dataflows (Recommended)
Supports lookup matching by email
Option B – Power Automate Flow
For each Excel row:
Find Contact where Email = Requester Email
Create Request record
Set Contact lookup
✔ All requests are now correctly linked to Contacts
✅ Step 6: Prevent Duplicate Contacts (Best Practice)
Create an Alternate Key on the Contact table:
Key Field: Email (
emailaddress1)
This ensures:
No duplicate Contact records are created later
Clean identity management
⚠ Common Mistakes to Avoid
❌ Importing requests before creating Contacts
❌ Linking requests to System Users instead of Contacts
❌ Relying on first login to create Contacts
❌ Creating placeholder users without identity mapping
🎯 Final Result
After implementing this approach:
✔ Historical data is correctly linked
✔ Users see their old requests on first login
✔ No duplicate contacts
✔ Power Pages authentication works smoothly
✔ Data model is future-proof
🏁 Final Thoughts
Power Pages works best when identity and data migration are planned together.
Pre-creating Contacts from Entra ID is the only scalable and production-ready solution for migrating historical user-linked data.
If you are building a POC or enterprise solution, this approach will save you from painful rework later.

Comments
Post a Comment