Archive

Archive for the ‘PowerApps’ Category

Power Platform | Managed Environments (preview)

As a Power Platform Admin its imperative to get your environment insights such as how many Apps in are not being used or how many Apps were shared with security groups or what are the implied DLP policies etc. So far there was no inbuilt feature in Power Platform to get the these insights.

If you are familiar with Center of Excellence (CoE) Kit you must be knowing on how to get insights of unused Apps and many other metrics. However Center of Excellence (CoE) Kit needs to be installed separately.

With Managed Environments (preview) feature this gap is being addressed in Power Platform.

Managed Environments

  • Managed Environment is a suite of capabilities that allows admins to manage Power Platform at scale with more control, less effort, and more insights.
  • Admins can enable Managed Environments on any type of environment (i.e., Default/Trial/Sandbox/PROD).

There are four primary elements of Managed Environments:

Enable Managed Environments:

  • Admins can enable Managed Environments using the Power Platform admin center or by using PowerShell.
  • To enable or Edit Managed Environment connect to Admin Center.
  • On the command bar, for an unmanaged environment, select Enable Managed Environments. For a managed environment, select Edit Managed Environments.
  • Configure Managed Environments settings and then select Enable.
  • Copy and restore environment lifecycle operations requires the Managed Environments property to be the same between source and destination.
  • Users with either the global admin, Power Platform service admin or Dynamics 365 admin Azure Active Directory roles are allowed to enable Managed Environments.
  • Users with the Delegated Admin role aren’t allowed to change the Managed Environments property in an environment.
  • Users with the Environment Admin (i.e., System Administrator) security role aren’t allowed to change the Managed Environments property in an environment.

Weekly Digests:

  • Once you opt for Weekly digest (i.e., Checking the ‘Include this environment’ checkbox) in the ‘Enable Managed Environments’ pane, Analytics about your top apps and flows, your most impactful makers, and inactive resources you can safely clean up are distilled and delivered to your mailbox once per week.

Sharing Limits:

Managed Environments allow admins to influence how broadly makers can share canvas apps. There are two sharing controls.

Sharing controlSystem behavior when checked?
Exclude sharing with security groupsMakers cannot share canvas apps with any security group.
Admins get the option to proceed with setting a limit on individuals shared to.
Limit total individuals who can be shared toMakers cannot share canvas apps with more individuals than specified in the text box.
  • Limit total individuals who can be shared to is only enabled if Exclude sharing with security groups is checked.
  • Sharing rules are enforced when makers attempt to share an app. Sharing rules do not change the audience apps in an environment that are already shared with.
  • Once sharing rules are set in the Power Platform admin center it may take up to 1 hour for the latest sharing rules to be propagated in the system and enforced.

Data Policies:

  • A principal capability of Managed Environments is enforcing Data loss prevention (DLP) policies.
  • New environment filters have been introduced to the data policies page in the Power Platform admin center that will help you identify all the data policies that are applied to an environment.
  • The environment filters are exclusively available for managed environments.
  • Open the Edit Managed Environments settings panel for a managed environment. In the Data policies section, select the See active data policies for this environment.
  • The data policies page opens in a new tab and displays only the data policies applied to the managed environment.

License considerations:

  • Managed Environments represents a value-add on top of existing premium Power Platform capabilities.
  • All low code assets (apps/flows) in a managed environment become premium and can be licensed using any of the Power Platform licensing options (per user, per app/flow or pay-as-you-go) or Dynamics 365 licenses that give premium usage rights.
  • Users must have a qualifying license to access the assets.
  • During the public preview the premium license requirement for applications and flows within a managed environment is not enforced.

Please refer the docs for more info.

Note:

🙂

PCF component import error | Publisher prefix for this control does not match the prefix for the solution

If you are New or Beginner in Power Apps component framework , I recommend you to refer PCF beginner article first.

Coming back to the blog post, other day while importing a solution with a PCF component, solution import failed with following error

Publisher prefix XXXX for this control XX.XXXX does not match the prefix XXX for the solution with Id xxxx-xxx-xxxxxxx-xxxxx-xxxxxx"

Reason:

To understand the issue better, lets reproduce the issue by building a simple pcf control by following steps below:

  • Open Visual Studio Code and point to an empty folder.
  • Open a Terminal and execute following command to create a Control by name ‘Helloworld’.
 pac pcf init -n HelloWorld -ns sample -t field -npm true
  • Now build the control by running “npm run build” command.
  • Now that we have control in built state, let me push the control to my development Dataverse environment.
  • Execute “pac auth create –url https://myorg.crm.dynamics.com” to connect to Dataverse environment first.
  • Then, push the control to the connected environment using “pac pcf push –publisher-prefix sample command.
  • Above ‘pac pcf push‘ command creates a new unmanaged solution with naming convention “PowerAppsTools_{publisher_prefix}”.
    • In my case, a new solution “PowerAppsTools_sample” got created, as I mentioned the Publisher Prefix name as sample.
  • So far we could build a new PCF control and pushed to the Dataverse instance.
  • In my Development Dataverse environment, I already have a solution by name “MyCoreSolution” with Publisher ‘Rajeev’ having a prefix as ‘raj‘.
  • Now I want to include the PCF control which we just built to my “MyCoreSolution” solution and deploy to another environment.
  • So add the “HelloWorld” control to MyCoreSolution solution and export and save a zip file in your machine.
  • Open the new Environment and try importing “MyCoreSolution” solution, which we exported in previous step.
  • Import fails with following error
Solution "MyCoreSolution" failed to import: Import Solution Failed: CustomControls with Name sample.HelloWorld Import Solution Failed with following error: Publisher prefix sample for this control sample.HelloWorld does not match the prefix raj for the solution

Fix/Best Practice:

  • Hope you got an idea with above example on what’s wrong with solution import.
  • Because the PCF control prefix (i.e.,sample) is different than the “MyCoreSolution” solution’s Publisher prefix (i.e.,raj) we got the exception during import.
  • To avoid such issues, make sure your PCF control prefix matches with your Solution’s Publisher prefix, while importing the control to a different Dataverse environment.

🙂

Categories: PowerApps Tags: , ,

General availability of Power Apps for Windows

With “Power Apps for Windows”

  • You can find all your canvas and model-driven apps including your Dynamics 365 apps and use them online or offline just like you can on iOS and Android!
  • You can configure model-driven apps to work automatically offline by creating an offline profile. For canvas apps, you can use the LoadData/SaveData functions to create a seamless offline experience.
  • Get device capabilities like camera, microphone, file picker, barcode scanning, geo-location and many others.

This app has been optimized for great app performance and supports the latest advanced feature provided by the Power Platform like the native Dataverse connector, Guest access and AI Builder.

Installing the App

  • Go to the Microsoft Store and install Power Apps for Windows.
  • When the app is installed, open it and sign in.
  • All your canvas and model-driven apps including your Dynamics 365 apps will be shown up as below.

Refer official documentation for more details.

🙂

Categories: PowerApps Tags:

PCF | Using Fluent UI and React | Error during react installation

Other day while building PCF project using Microsoft Fluent UI and React, got an error while installing ‘React’ using following command.

npm install react react-dom @fluentui/react

Reason and Fix:

  • Reason was, React 18 was installed in my machine and Fluent UI will not install since it requires a React version less than 18.
  • To fix the issue run following commands which uninstalls the current version and installs Fluent compatible version of React.
npm uninstall react react-dom @fluentui/react
npm install react@16.8.6 react-dom@16.8.6 @fluentui/react@8.29.0

Please refer Scott Durow article on the same issue.

🙂

Categories: PowerApps Tags: , ,

Power Platform CLI | Pack and Unpack solution using map xml

June 16, 2022 1 comment

Microsoft Power Platform CLI is a developer Command Line Interface, that empowers developers and ISVs to perform various operations related to environment lifecycle, authentication, and work with Dataverse environments, solution packages, portals, code components, and so on.

In this article lets learn how to use Pack and Unpack Solution Commands with map xml file.

Getting started with CLI:

  • There are 2 ways to install and use CLI.
    • Standalone Power Platform CLI :
    • Using Power Platform Tools for Visual Studio Code:
      • Follow steps specified here.
      • Power Platform Tools for Visual Studio Code is available on Windows 10, Windows 11, Linux, and MacOS.

Understanding Unpack and Pack commands:

  • Solutions are the mechanism for implementing application lifecycle management (ALM).
  • Its imperative to version control the Solution components to platforms such as Azure DevOps, Git Hub to maintain healthy ALM.
  • With the help of Unpack and Pack commands we can commit the Solution Components which enables version control.
Using Unpack command:
  • Lets you unpack solution zip files after they’ve been exported to the filesystem.
  • First export the solution to your machine.
    • In my case, I have ‘almplugins_1_0_0_0‘ solution exported and placed in ‘D’ drive.
  • To use ‘Unpack’, open the Command Prompt in ‘Admin Mode’ and run following command.
pac solution unpack -z D:\Practice\CLI\almplugins_1_0_0_0.zip -f D:\Practice\CLI\almpluginsunpacked.
  • Once the command executed successfully, Solution components unpack to “D:\Practice\CLI\almpluginsunpacked” path as specified in unpack command.
    • Note: My ‘almplugins_1_0_0_0.zip‘ solution had only a ‘Plug-in assembly’ and ‘Plugin Steps’ hence you would see only those designated folders.
    • If the solution contains other components like Entities, Security Roles, Flows, etc. other relevant folders gets generated.

Using pack command:
  • Lets you pack files on a filesystem into a solution zip file.
  • Now, lets pack the Solution Components from the almpluginsunpacked folder using following pack command.
pac solution pack -z D:\Practice\CLI\almpluginpacked.zip -f D:\Practice\CLI\almpluginsunpacked.
  • Once the command executed, you would find a new zip folder with name (i.e.,almpluginpacked.zip), specified in ‘pack’ command.

Now that you got some knowledge on usage of unpack and pack. Now lets use them with map xml file.

Why we need map xml:

  • Files that are built in an automated build system, such as plug-in assemblies, are typically not checked into source control.
  • If you open the almpluginsunpacked folder generated by unpack, there will be .dlls which are not supposed to be presented.
  • Also, while packing the solution components using ‘pack’, you would want the latest .dlls from your Plugin VS project to be packed.
  • map xml helps in above 2 scenarios. Lets see the usage of map xml in next section.
<?xml version="1.0" encoding="utf-8"?>
<Mapping>
    <FileToFile map="PFESamplePlugins.dll" to="..\..\src\\Plugins\bin\**\PFE.Sample.Plugins.dll" />

    <FileToPath map="WebResources\*.*" to="..\..\src\WebResources\dist\**" />
    <FileToPath map="WebResources\**\*.*" to="..\..\src\WebResources\dist\**" />
</Mapping>

unpack command with map xml:

  • As my almplugins_1_0_0_0 solution has 2 Plug-in assemblies, I got following 2 folders by executing unpack command.
  • If I go deep in to folders, there are alm-plugins2.dll and almplugins.dll as they were unpacked from almplugins_1_0_0_0 solution.
  • Lets run unpack again with map.xml.
Prepare map xml
  • My Plug-in projects folder structure is as follows.
  • Path of my alm-plugins2.dll will be C:\Users\rajeevpe\Source\repos\alm-plugins-v2\alm-plugins2\bin\Release\alm-plugins2.dll
  • Path of my alm.plugins.dll will be C:\Users\rajeevpe\Source\repos\alm-plugins-v2\alm-plugins\bin\Release\alm.plugins.dll
  • The map.xml structure will be as below
<?xml version="1.0" encoding="utf-8"?>
<Mapping>
    <FileToFile map="D:\Practice\CLI\almpluginsunpacked\PluginAssemblies\**\alm-plugins2.dll" to="C:\Users\rajeevpe\Source\repos\alm-plugins-v2\alm-plugins2\bin\Release\alm-plugins2.dll" />
    <FileToFile map="D:\Practice\CLI\almpluginsunpacked\PluginAssemblies\**\almplugins.dll" to="C:\Users\rajeevpe\Source\repos\alm-plugins-v2\alm-plugins\bin\Release\alm.plugins.dll" />    
</Mapping>
  • Save the map xml file with above content and execute following unpack command.
pac solution unpack -z D:\Practice\CLI\almplugins_1_0_0_0.zip -f D:\Practice\CLI\almpluginsunpacked\. -m D:\Practice\CLI\map.xml
  • This time, map file was considered by unpack command and skipped the generation of dlls in unpack folder location.

pack command with map xml:

As we have seen, unpack with map file would not generate dlls in to unpacked folder. The objective of map file during pack is to consider the latest .dlls from your Plugin VS project location.

Since we already prepared map xml file, we can refer the same in pack command as below.

pac solution pack -z D:\Practice\CLI\almplugins_1_0_0_0.zip -f D:\Practice\CLI\almpluginsunpacked\. -m D:\Practice\CLI\map.xml
  • If you notice, .dlls were mapped (i.e., copied) from plug-in VS projects location and packed in to a zip folder which can imported to target environments.

Hope you gained some knowledge on usage of pack and unpack commands using map xml file. In this article I only considered Plug-ins but map file can be used with Web resources as well.

Following articles provides more details.

Note:

  • Azure DevOps pipeline’s ‘Power Platform Pack Solution’ and ‘Power Platform UnPack Solution’ tasks uses PAC CLI and at the time of writing this article, both ‘Power Platform Pack Solution’ and ‘Power Platform UnPack Solution’ tasks does not support map xml.

🙂

Categories: PowerApps Tags: ,

Power Platform CLI | Authenticate environment using device code

For unversed, Microsoft Power Platform CLI is a developer CLI that empowers developers and ISVs to perform various operations related to environment lifecycle, authentication, and work with Dataverse environments, solution packages, portals, code components, and so on.

In this blog post, lets see how to connect to an Environment using Power CLI ‘Device Code’ authentication option.

Using CLI:

  • Open Command Prompt.
  • Execute pac command to make sure the Power Platform CLI is installed on your machine. You get following screen, if CLI is already installed.
  • If not installed, Download and install Microsoft Power Platform CLI.
  • Now to connect to Power platform environment, we can use following pac auth create command by passing either Username & Password or ApplicationID & ClientSecret combination.
pac auth create [--name] [--kind] [--url] [--username] [--password] [--applicationId] [--clientSecret] [--tenant] [--cloud] [--deviceCode]
  • We can also authenticate using ‘deviceCode’, which I will explain in next section.

Authenticate using Device Code:

Now we can also authenticate to an environment by generating a ‘Device Code’ as mentioned in steps below.

  • From console, run following pac auth create command
pac auth create --url https://{your environment}.crm.dynamics.com -dc
  • You would get a notification with ‘Device Code‘, “To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code RXXXXZ to authenticate.
  • Complete the sign in by providing your credentials.
  • You will get following message post successful authentication.
  • Now you can close the browser and good to start executing pac cli commands from console.

Key Points:

  • Currently, Microsoft Power Platform standalone CLI is supported only on Windows 10 and Windows 11.
  • Power Platform Tools for Visual Studio Code is available on Windows 10, Windows 11, Linux, and MacOS.

🙂

Categories: PowerApps Tags: , , ,

Power Apps Maker Portal | Create tables with Table hub and new designer

Have you noticed that the Tables in Maker portal got a new a hub view and designer?. If it looks familiar, hub view and designer was only available in Power Apps for Teams app before and now its available in Maker portal too.

Hub view and designer for a table features :

Following is the list of features.

  • Provides an overview of the table subcomponents (i.e., Columns, Forms, Views, Business rules, etc…) in a single view.
  • New columns can be created in-line with in the table as shown below.
  • Click on ‘Edit’ from above screen, will take you to a focused screen where you can Add Columns and Add Data.
  • With appropriate privileges data can be created and updated by using ‘Add data’ option.
  • Fill columns and tab out, the data gets auto saved.
  • Now we can generate an app starting from your table. This will allow you to quickly create and play the app in your browser.
  • Click on ‘Create’ will take you to ‘App Designer’, where you can further configure and Publish the App.
  • Now my favorite of the lot is the ‘Tools‘ menu, where we can directly navigate to Web API links of ‘Table Definition’ and ‘Table data’.

🙂

Microsoft Build 2022 | Power Platform updates

In Build 2022 , Microsoft announced an exciting new Microsoft Power Platform product and many new capabilities across Microsoft Power Platform that include:

Please refer the following links for a deep dive.

🙂

Power Platform | Power Apps | Creator Kit (Preview)

If you are a beginner or expert in Power Apps Canvas Apps, building a consistent and intuitive user experience is always challenging, as there were no standard guidelines.

Using the Creator Kit (Preview) from Microsoft Power CAT team, now you can seamlessly create consistent and effective user experiences using pre-built controls and components built on the Fluent UI framework.

In this blog post, lets see how to install and use the ‘Creator Kit’.

Prerequisites:

To use ‘Creator Kit’, following Prerequisites must be fulfilled.

  • Power Platform environment with Dataverse database 
  • Power Apps component framework feature enabled (Refer next section on steps to enable).
    • Feature has to be enabled before you import ‘Creator Kit’ solution.
  • System Customizer security role is needed to use the Creator Kit components.
  • A Premium Power Apps license is required to develop and use apps with custom components.

Enable Power Apps component framework feature:

  • Code components contain code that may not be generated by Microsoft and can potentially access security tokens and data when rendered in Power Apps Studio.
  • Hence to add code components to your app, you need to enable the Power Apps component framework feature in each environment.
  • By default, the Power Apps component feature is enabled for model-driven apps but not for Canvas Apps.
  • To enable sign in to Power Apps with ‘System Administrator’ role.
  • Select Settings Settings., and then select Admin Center.
  • Go to the Environment, and click on ‘Settings’
  • From ‘Settings’ screen, navigate to ‘Product -> Features’.
  • Turn on Power Apps component framework for canvas apps, and then select Save.

Assuming all prerequisites are configured, lets proceed with ‘Creator Kit’ installation and usage.

Install ‘Creator Kit’:

  • ‘Creator Kit’ comes as a ‘Managed’ solution and download the solution from here.
  • Connect to Power Apps maker portal and pick the Environment where you want to install the ‘Creator Kit’.
  • Import the solution.

‘Creator Kit’ Components:

Once you imported the ‘Creator Kit’ solution, open the Solution and you would find following components.

Now that we know how to install and the components of ‘Creator Kit’, lets dive in to the details of each component.

Creator Kit Reference App:

  • This canvas app helps as a guide and allows you to learn about each component, recommended best practices for optimal user experience and see the implementation code (Select the Code tab to see the Power Fx formulas used).

Canvas Template App:

‘Canvas Template’ App contain all the reusable components of ‘Creator Kit’. To use the ‘Creator Kit’ components in your own Canvas App, follow the steps.

  • Create a new Solution. I’ve named my solution as ‘Use Creator Kit‘.
  • Open the Solution and add the ‘Canvas Template‘ app which is part of ‘Creator Kit’ managed solution, by using Add existing > Apps > Canvas action in the ribbon.
  • Now open the ‘Canvas Template‘ app by using ‘Edit’ option.
  • You will get following warning popup because the app contain custom code components. Continue by clicking ‘Open app’.
  • Now, create a copy of the app by select File > Save As and enter a new name for the copy. I named my app as ‘Canvas App from Template‘.
  • Click ‘Save’ and the copy will appear in the same solution (i.e., ‘Use Creator Kit’ in my case).
  • Now we have our own App (i.e., Canvas App from Template) to start with, remove the original ‘Canvas Template‘ app from the solution to avoid confusion.
  • Open our ‘Canvas App from Template‘ app and you would find 2 screens (Template Screen and Controls Screen).
  • ‘Controls Screen’ contain all the code components of ‘Creator Kit’ for our development reference. We can select any of the controls and understand the properties which helps while building our screens.
  • ‘Template Screen’ contain placeholders to head start your development.
  • You can customize ‘Template Screen’ as per your requirement and can also add ‘Code Components/Library Components’ installed from ‘Creator Kit’ as needed.

Fluent Theme Designer App:

Use this app to generate a Theme JSON object for styling components consistently. To generate follow below steps.

  • Either open the ‘Creator Kit’ solution which you downloaded and imported or go to ‘Apps’ from maker portal and select the ‘Fluent Theme Designer App’ and ‘Play’.
  • Choose the Primary color, Text color, and Background color values as per your need.
  • Select Export theme from the top-right corner to generate the Power Fx expression version of the Theme JSON, then copy the value from the panel.
  • Save the Theme JSON as a global variable in the OnStart property of your app, with the ‘palette’ code block as a property of the AppTheme object variable.
Set( AppTheme, {
  palette: {
    themePrimary: "#0078d4",
    themeLighterAlt: "#eff6fc",
    themeLighter: "#deecf9",
    themeLight: "#c7e0f4",
    themeTertiary: "#71afe5",
    themeSecondary: "#2b88d8",
    themeDarkAlt: "#106ebe",
    themeDark: "#005a9e",
    themeDarker: "#004578",
    neutralLighterAlt: "#faf9f8",
    neutralLighter: "#f3f2f1",
    neutralLight: "#edebe9",
    neutralQuaternaryAlt: "#e1dfdd",
    neutralQuaternary: "#d0d0d0",
    neutralTertiaryAlt: "#c8c6c4",
    neutralTertiary: "#a19f9d",
    neutralSecondary: "#605e5c",
    neutralPrimaryAlt: "#3b3a39",
    neutralPrimary: "#323130",
    neutralDark: "#201f1e",
    black: "#000000",
    white: "#ffffff"
  }
});

Canvas components:

Components are reusable building blocks for canvas apps so that app makers can create custom controls to use inside an app, or across apps using a component library.

In ‘Creator Kit’ components are defined in the component library called Power CAT Component Library.

Code Components:

App makers can use Power Apps component framework (PCF) to create code components that can be used in their canvas apps.

  • In ‘Creator Kit’, ‘Code Components’ are defined as individual custom controls in the solution.

Hope you got some knowledge on the usage of ‘Creator Kit’ and I highly recommend to explore this.

The best part is its an open source project and you can view the code in the latest version of the ‘Creator Kit’ in the GitHub repository

🙂

Categories: PowerApps Tags: , ,

Power Fx | String Interpolation

If you are familiar with C# language’s string interpolation feature now Power Fx does too.

C# String Interpolation Example:
string name = "Mark";
var date = DateTime.Now;

// String interpolation:
Console.WriteLine($"Hello, {name}! Today is {date.DayOfWeek}, it's {date:HH:mm} now.");

In Power Fx, use string interpolation to embed formulas within a text string.

This is often easier to work with and visualize the output than using the Concatenate function or & operator.

Splicing a long string with the ‘&’ operator or ‘Concatenate’ function:

  • Following is an example of splicing a string with ‘&’ operator or ‘Concatenate’ function.
"Hello User : " & User().FullName & " Your Email is : " & User().Email // '&' operator
Concatenate("Hello User : ",User().FullName," ;Your Email is : ",User().Email) // 'Concatenate' function

Using Power Fx String Interpolation:

Above String splicing can be easily done using String Interpolation

  • Prefix the text string with a $ and enclose the formula to be embedded with curly braces { }.
  • To include a curly brace in the text string, use repeated curly braces: {{ or }}.
  • String interpolation can be used anywhere a standard text string can be used

$"Hello User : {User().FullName} Your Email is : {User().Email}"

Few more Examples:

$"2+3 = {2+3}"  
// result: 2+3 = 5

$"{{this is inside curly braces}}" // result: {this is inside curly braces}

With( {x:5, y:7},
      $"Point ({x},{y}) is {Text( Sqrt( x^2+y^2 ), "#.###" )} from the origin" )
// result: Point (5,7) is 8.602 from the origin

With( {FirstName: "John", MiddleName: "Q.", LastName: "Doe"},
      $"{Trim( $"Welcome {FirstName} {MiddleName} {LastName}" )}, we're glad you are here!" )
// result: Welcome John Q. Doe, we're glad you are here!

🙂