Skip to main content

Power Pages Site Component Tool

 If you have worked with Power Pages using the Enhanced Data Model, you know the pain of manually adding all the site components to a Dataverse solution.  It's tedious, error-prone, and frankly, there are a lot of components to track down.  You need to add the site record, the site languages, and then every individual component — Web Pages, Web Templates, Content Snippets, Site Settings, Table Permissions, Basic Forms, Advanced Forms, and more.  Miss one and your deployment won't work as expected.

To solve this problem, we built an open source .NET console application called PowerPages.SolutionComponents.Console.  This tool automates the entire process of discovering and adding all Power Pages site components to a Dataverse solution in one shot.

What Does It Do?

The tool connects directly to your Dataverse environment and does the following:

  1. Adds the Power Pages Site record to your solution.
  2. Finds and adds all related Power Page Site Languages.
  3. Finds and adds every Power Page Component associated with the site.  This covers all component types including:
    • Web Pages
    • Web Files
    • Web Templates
    • Content Snippets
    • Page Templates
    • Site Settings
    • Web Roles and Website Access records
    • Basic Forms and Basic Form Metadata
    • Advanced Forms, Steps, and Metadata
    • Table Permissions
    • Column Permission Profiles and Column Permissions
    • Web Link Sets and Web Links
    • Site Markers
    • Redirects
    • Shortcuts
    • Cloud Flows
    • Bot Consumers
    • UX Components and Server Logic
    • And more

Prerequisites

Before running the tool you will need the following:

  1. .NET 8.0 SDK or later installed on your machine.
  2. Access to your Power Platform environment with System Administrator or equivalent permissions.
  3. The Unique Name of the solution you want to add the components to (the internal name, not the display name).
  4. The GUID of your Power Pages site.  You can find this in the Power Pages Management app or via the Power Platform CLI.

How to Use It

Using the tool is straightforward.  Clone the repository, build it, and run it.

  1. Clone the repository from GitHub.
  2. Build the project:
    dotnet build
    
  3. Run the application:
    dotnet run --project PowerPages.SolutionComponents.Console
    
  4. Follow the interactive prompts.  The tool will ask you for:
    • Environment URL — Your Dataverse environment URL (e.g., https://yourorg.crm.dynamics.com).
    • Solution Unique Name — The internal unique name of your solution.
    • Power Pages Site GUID — The GUID of the site whose components you want to add.
    • Exclude Site Settings — Whether to skip certain site settings based on prefixes (more on this below).

When you first run the tool, the Microsoft.PowerPlatform.Dataverse.Client library will open a browser window for interactive authentication.  Once authenticated, the tool does the rest automatically.

The Exclude Site Settings Feature

A particularly useful feature is the ability to exclude specific site settings from being added to the solution.  This is particularly helpful when you are deploying across environments that have different identity providers.  For example, you probably don't want the Authentication/* settings from a development environment getting pushed into production and overwriting the production identity provider configuration.

By default, the tool excludes any site setting with the Authentication/ prefix when you opt in to the exclusion option.  You can customize this list by editing the ExcludedSiteSettingPrefixes list in PowerPages.SolutionComponents.Console\Constants\ExcludedSettings.cs before building.

One Thing to Be Aware Of

The tool automatically adds the related Dataverse tables to the solution as part of the process.  If your deployment strategy only requires the Power Pages Site, Components, and Languages to be in the solution — and not the full table definitions — you will need to manually remove the table definitions from the solution after the tool finishes running.  This is a known consideration and is called out in the README on the GitHub project.

Get the Code

The project is 100% open source.  You can find the full source code, clone the repository, or contribute at the link below.

https://github.com/JamesStuder/PowerPages.SolutionComponents.Console

If the tool proves useful or any issues are encountered, feel free to open an issue or submit a pull request on GitHub.

Comments

Popular posts from this blog

Validating User Input In CRM Portals With JavaScript

When we are setting up CRM Portals to allow customers to update their information, open cases, fill out an applications, etc. We want to make sure that we are validating their input before it is committed to CRM.  This way we ensure that our data is clean and meaningful to us and the customer. CRM Portals already has a lot validation checks built into it. But, on occasion we need to add our own.  To do this we will use JavaScript to run the validation and also to output a message to the user to tell them there is an issue they need to fix. Before we can do any JavaScript, we need to check and see if we are using JavaScript on an Entity Form or Web Page.  This is because the JavaScript, while similar, will be different.  First, we will go over the JavaScript for Entity Forms.  Then, we will go over the JavaScript for Web Pages.  Finally, we will look at the notification JavaScript. Entity Form: if (window.jQuery) { (function ($) { if ...

Power Pages Update Last Successful Login Using JavaScript and Power Pages API

 Recently while working on a Power Pages implementation for a client, I had the requirement to show the last time a user logged in on their profile page.  I thought this would be easy to do as there is already a field on the contact record for "Last Successful Login" (      adx_identity_lastsuccessfullogin).  This use to update when a user logged in, but it appears Microsoft has removed that automation. While searching I came across a few different ways of achieving this task.  One used application insights in Azure and another one used an HTTP endpoint setup in Power Automate.  I thought, this needs to be simpler.  What I came up with is to use Liquid with JavaScript to tell if a user is logged in or not.  Then use the new Power Pages api to update the logged in users contact record to mark the last time they logged in. Here is the approach I setup: 1) Make sure you turn on the api for contact in Site Settings. 1) Link to Microsoft Do...

Reusable Method To Get Record By Id

I have a handful of reusable code that I use when creating plugins or external process (i.e. Azure Functions) for working with DataVerse. The first one I am providing is Getting a Record By Id: 1: private static Entity GetFullRecord(string entityName, string primaryKey, Guid recordId, IOrganizationService service) 2: { 3: using (OrganizationServiceContext context = new OrganizationServiceContext(service)) 4: { 5: return (from e in context.CreateQuery(entityName) 6: where (Guid)e[primaryKey] == recordId 7: select e).Single(); 8: } 9: } entityName = The logical name of the entity primaryKey = The primary key field for the entity. If using late binding you can create this dynamically by doing: $"{target.LogicalName}id" recordId = Guid of the record to get service = Service to interact with DataVerse