DEV Community

Andrew Elans
Andrew Elans

Posted on • Edited on

Power Pages SPA: main setup

In this post I provide high-level requirements for provisioning of a Single Page Application with Power Pages. I will not dive deep in these as many tutorials can easily be found online.

I provide hereby my settings.

Setups

Create new environment

Create a new environment in Power Platform admin center.

New -> fill in details -> enable Add a Dataverse data store -> click Next to select Dataverse settings -> Select Language (NB! see Notes) -> click Save.

Notes on Language of Dataverse

You may tend to select English (United States) to have table names, settings and UI in English. However, if your data will have some Latin-1 characters like æ å ø, you would need to select the right language from start, in my case it's norsk bookmål (Norge).

Why? It has to do with the database collation issues when sorting and searching Latin-1 specific characters.

Here is the difference:
Image description

If you have selected norsk bookmål (Norge) and then change UI language to English (I prefer English and usually set UI to it), it will work. However, some of the limitation include inability to see some of the environment settings due to language differences. You would have to switch back to Norwegian in cases you would need to change some specific settings.

Make a new Power Pages website

Go to Power Pages and select newly created environment.

Click Start from blank -> fill in site details -> Done

Settings in Microsoft Azure

Open newly created portal in Azure portal

App registrations

Go to API permissions -> Add a permission -> find and add -> Dynamics CRM, user_impersonation (Access Common Data Service as organization users) -> Microsoft Graph, User.Read (Sign in and read user profile) and User.Read.All (Read all users' full profiles) -> Click Grant admin consent for Your-Organization

Authentication

To add redirect URIs, that are required for obtaining tokens, click Add Platform.

a) Select Web -> add https://your-site.powerappsportals.com/ -> click Configure
b) Select Single-page application -> add https://127.0.0.1:8000/ -> click Configure

We need now to tweak some things in Authentication but through Manifest as URI in Authentication do not allow save wild character * or http scheme.

c) Go to Manifest on the left pane -> find "spa": {"redirectUris": ... there and change from:

"spa": {
    "redirectUris": [
        "https://127.0.0.1:8000/"
    ]
}
Enter fullscreen mode Exit fullscreen mode

to:

"spa": {
    "redirectUris": [
        "http://127.0.0.1:8000/*",
        "https://your-site.powerappsportals.com/*",
    ]
}
Enter fullscreen mode Exit fullscreen mode

Settings in Power Pages designer

In the pages designer select your site -> click Edit:

Security tab -> Identity providers:

Since I'm making the app for corporate employees, I will use only Microsoft Entra ID authentication.

1) Disable Local sign in
2) Enable Microsoft Entra ID and set as default

Page permissions

Select Home page -> Edit permissions -> select I want to choose who can see the page -> select Authenticated Users -> enable Apply these permissions to all files on this page.

This last setting will allow to restrict your script files to be read by unauthorized people.

Top comments (0)