Building a robust data model is a critical step when developing cloud-based applications in Microsoft Power Pages. While a visually appealing website is important, the real power lies in how your data is structured, stored, and connected.
In this guide, we’ll walk through how to:
- Create a data model for Power Pages
- Automatically generate tables and relationships
- Customize your schema
- Add sample data for testing
- Prepare your application for real data integration
Prerequisites
Before diving in, ensure you have:
- A Power Pages site already created and deployed
- Access to Microsoft Dataverse
- Visual Studio Code installed
- Necessary Power Platform permissions
This tutorial builds on previous steps where the website has already been set up and deployed.
Why Data Modeling Matters in Power Pages
At this stage, your Power Pages site may still rely on placeholder or mock data. A proper data model enables:
- Structured data storage
- Scalable application architecture
- Seamless integration with APIs and external systems
- Better reporting and analytics (including Power BI integration)
Step 1: Generate a Data Model Using VS Code
Power Pages allows you to quickly scaffold a data model using built-in commands.
Run the Data Model Setup Command
In Visual Studio Code, execute:
/setup data model
This command will:
- Analyze your existing application
- Recommend a set of tables
- Generate an Entity Relationship Diagram (ERD)
- Create relationships between tables
- Prepare the schema for deployment
You’ll be prompted to confirm permissions and answer a few configuration questions.
Step 2: Review and Customize the Generated Tables
Once the process runs, an HTML preview will display the proposed data model.
Example Tables Created
The system typically generates tables such as:
- Service Categories
- Service Requests
- Service Request Notes
- Attachments
- Contact (existing table)
Key Customizations
Before finalizing, review and adjust:
1. Prefix Naming Convention
Instead of default prefixes, define your own (e.g., PW for your organization).
2. Column Data Types
For example:
- Change Request Number from text → Auto Number
- Add meaningful prefixes (e.g.,
SR-0001)
3. Field Validation
Ensure fields like:
- Titles
- Descriptions
- Relationships
…match your business logic.
Step 3: Approve and Deploy the Data Model
Once satisfied:
- Approve the schema
- Allow the system to create tables
- Wait for validation and deployment (this may take several minutes)
During deployment, the system:
- Runs pre-checks
- Creates tables in Dataverse
- Establishes relationships
- Publishes the schema
Step 4: Create a Solution in Power Apps
To manage and deploy your components efficiently:
- Go to Power Apps
- Navigate to Solutions
- Create a new solution
- Define:
- Publisher
- Prefix (e.g.,
PW)
Why Use Solutions?
Solutions help you:
- Move assets from Dev → QA → Production
- Package tables, apps, and components
- Maintain version control
Step 5: Add Tables to Your Solution
After deployment:
- Add existing tables using your prefix (e.g.,
PW) - Include all related objects
This ensures everything is centrally managed.
Step 6: Build a Model-Driven App
To visualize and interact with your data:
- Create a Model-Driven App
- Add pages using Dataverse tables
- Include:
- Newly created tables
- Contact table
This app acts as a quick interface to validate your data model.
Step 7: Populate Sample Data
To test your model, generate mock data using:
/add sample data
Configuration Options:
- Select tables (or all tables)
- Define number of records (e.g., 5 per table)
What Happens Next:
- The system validates prerequisites
- Inserts sample records
- Links related data automatically
You’ll start seeing:
- Service categories populated
- Service requests generated
- Relationships reflected in real time
Step 8: Validate Data in Your App
Open your model-driven app and:
- Refresh tables
- Verify records are being populated
- Check relationships between entities
This confirms your data model is functioning correctly.
Important Best Practices
1. Backup Regularly
At each stage:
- Export your solution
- Save a ZIP backup
- Use source control if possible
2. Validate Data Types Early
Incorrect data types can cause issues later when integrating APIs or Power BI.
3. Use Meaningful Naming Conventions
Consistent prefixes and naming improve maintainability.
4. Monitor Automated Processes
The system may retry failed steps automatically review logs when needed.
What’s Next?
At this point:
- Your data model is complete
- Tables and relationships are deployed
- Sample data is available
However, your Power Pages site is still not connected to this data.
Upcoming Step:
In the next phase, you will:
- Bind your data model to your website
- Use APIs (such as Web API)
- Replace mock UI with real, dynamic data
Conclusion
Creating a data model in Power Pages using Dataverse is a powerful way to accelerate development while maintaining flexibility and scalability. By leveraging automated tools and customizing where needed, you can quickly move from a static website to a fully data-driven application.
This foundational step sets you up for:
- Real-time data interaction
- Integration with Power BI
- Enterprise-grade application development



