Power Apps | ‘Host’ object

Assume that you are a Power Apps maker and you have built an app and shared it with users. A few users have reported issues, and you would like to know the following from the users to troubleshoot:

  • Browser
  • Operating System (OS)
  • Session ID
  • Tenant ID

So what’s the best way to get those details. The solutions is by using a Host object in Power Apps.

What and how to use the Host object:

  • The Host object in Power Apps provides information about the current host running the app.
  • The host object is currently only available in custom pages and canvas apps.
  • To access the Host object, expand the App object at the top of the Tree view pane and then select it.

Host object properties:

  • The text property BrowserUserAgent contains the complete user agent string that the browser uses to identify itself when running the app.
  • For example, a browser user agent string might be:
    • Mozilla/5.0 (Windows NT 10.0; Win64; x64)
    • AppleWebKit/537.36 (KHTML, like Gecko)
    • Chrome/ Safari/537.36 Edg/109.0.1518.78`

  • The OSType property provides the name of the operating system where the app is running.
  • Examples : Windows, macOS, iOS, Android, Linux

  • The SessionID property returns the GUID that identifies the current session.


  • The TenantID property provides the Globally Unique Identifier (GUID) that specifies the Azure Active Directory (AAD) tenant associated with the presently authenticated user.



[Step by Step] Create an AppSource package using Package Deployer tool

Lets say you have built a Power Apps business application or Service and you want to promote it to AppSource, In this article, I am going to provide a detailed walkthrough of generating an AppSource package.

What is an AppSource:

  • Microsoft AppSource is an online store that contains thousands of business applications and services built by industry-leading software providers.
  • You can use AppSource to find, try, buy, and deploy the business software and services that help you run your business.
  • As an example, Creator Kit is a collection of Fluent UI controls, Templates for Power Apps makers and is available on AppSource.

AppSource package structure:

An AppSource package consists of the following files:

From the above list of required files, generating the ‘Package file'(i.e.,pdpkg.zip) using Package Deployer Tool is the major work.

What is a package file:

A Package Deployer package can consist of any or all of the following:

  • One or more Dataverse solution files.
  • Flat files or exported configuration data file from the Configuration Migration tool. For more information about the tool, see Move configuration data across instances and organizations with the Configuration Migration tool.
  • Custom code that can run before, while, or after the package is deployed to the Dataverse instance.
  • HTML content specific to the package that can display at the beginning and end of the deployment process. This content can be useful to provide a description of the solutions and files that are deployed in the package.

Now that we know what files are required for AppSource package, lets get started with the generation of Package Deployer package.

Steps to generate Package Deployer package:

As we know package deployer package contains one or more Dataverse solution files along with data files, In this article I will be focusing only on Dataverse solutions.

In this example, I am going to package two solutions ‘Solution 1’ and ‘Solution 2’.

  • Following are those two solutions from my ‘DEV’ environment.
  • From the Power Apps maker portal, download the two solutions and save it locally.
  • Next, open the Visual Studio 2019 or later, or Visual Studio Code. I am using VS2022.
  • Make sure you already installed Power Platform Tools extension to your Visual Studio.
  • Create a new project and choose ‘Power Platform PD Package project’ template as shown below.
  • In the project details pane, provide Project name. Click Next.
  • Provide package related details as shown below. To know more about the properties refer the docs here.
  • Click ‘Create’ to complete the project creation.
  • You should see your ‘Solution Explorer’ looks as below
  • As a first step, build the project and make sure it builds with no errors.
  • Now we need to add our download Dataverse solutions to this project. For that, in Visual Studio, select switch to folder view.
  • Add the two Dataverse solutions which we downloaded previously, under the PkgAssets folder.
  • We can also update the HTML language specific files.
  • In the Solution Explorer pane, expand PkgAssets > Content > en-us. You’ll find two folders called EndHTML and WelcomeHTML.
  • These folders contain the HTML and associated files that enable you to display (to the user) information at the end and beginning of the package deployment process.
  • Edit the files in the HTML folder of these folders to add information to display for your package.

Configure the package:

As the next step, we need to provide configuration information like Import order of your solutions and whether to install sample data as part of this package, etc.

We will be updating the ImportConfig.xml file.

  • Open the ImportConfig.xml file and the structure looks as below.
  • Under <solutions> tag, define your order of solution import to target.
  • In my case, I want ‘Solution1_1_0_0_1_managed.zip’ to be imported first and then ‘Solution2_1_0_0_1_managed.zip’. So I added my solutions info to <solutions> tag as below.
    <configsolutionfile solutionpackagefilename="Solution1_1_0_0_1_managed.zip" />
    <configsolutionfile solutionpackagefilename="Solution2_1_0_0_1_managed.zip" />
  • You can also following properties
    • overwriteunmanagedcustomizations :  
      • Specify whether to overwrite any unmanaged customizations when importing a solution that already exists in the target.
      • This attribute is optional, and if you do not specify this attribute, by default the unmanaged customizations in the existing solution are maintained on the target.
    • publishworkflowsandactivateplugins:
      • Specify whether to publish workflows and activate plug-ins in the target after the solution is imported.
      • This attribute is optional, and if you do not specify not specify this attribute, by default the workflows are published and plug-ins are activated after the solution is imported on the target.
  • With the above additional properties, your solution configurations looks below.
     <configsolutionfile solutionpackagefilename="Solution1_1_0_0_1_managed.zip"  
     <configsolutionfile solutionpackagefilename="Solution2_1_0_0_1_managed.zip"  

There are other configurations related to sample data import, which I will cover in a separate article. Refer this to know more.

Add custom code:

You can add custom code that executes before, during, and after the package is imported into an environment. As an example, I need to enable “Power Apps component framework for canvas apps” before my solutions gets imported to target.

Lets see how to add the custom code to enable “Power Apps component framework for canvas apps”. For that, we need to edit the PackageImportExtension.cs file.

  • From your Visual Studio, switch to Solution View and open the PackageImportExtension.cs file.
  • In the ‘InitializeCustomExtension()’ function, add the following code.
        public override void InitializeCustomExtension()
            // Enable PCF for canvas
            var query = new QueryExpression("organization");
            var result = CrmSvc.RetrieveMultiple(query);
            var environmentSettings = result.Entities[0];
            environmentSettings["iscustomcontrolsincanvasappsenabled"] = true;
            // Trigger update
  • Build the solution and make sure its succeeded.
  • Once the build succeeds, we need to publish the project, to generate the deployment package.
  • Trigger dotnet publish (All lowercase) command either from command prompt or from ‘Package Manager Console’.
  • dotnet publish generates ‘your_package_name.pdpkg.zip’ file. This is the package deployer file.
  • Go to bin/Debug folder and you would find the ‘.pdpkg.zip’ file. In my scenario, my package file name is ‘AppSourceDemo.1.0.0.pdpkg’.
Test the package deployer file:

It’s highly recommended testing your package deployer file (.pdpkg.zip) before moving this to AppSource package. I will be using pac cli to test the package deployer file.

  • Open the command prompt. Make sure you install pac cli ,if not installed already.
  • As we are going deploy the generated .pdpkg.zip file to a test environment, first create a connection using pac auth create command.
  • Next we are going to use pac package deploy command to deploy the package.
  • If your package is properly generated, pac package deploy command execution should be succeeded as below.

Now we are ready with the package deployer package file (i.e.,AppSourceDemo.1.0.0.pdpkg). Lets proceed with other files configuration.

Create [Content_Types].xml file:

You can use the same ‘[Content_Types].xml’ file available under the generated AppSourceDemo.1.0.0.pdpkg file.

  • Unzip the package deployer package file (i..e, AppSourceDemo.1.0.0.pdpkg).
  • Copy and save a copy of the [Content_Types].xml.
  • We will use this file in next steps.

Create an icon for your AppSource package:

  • Create an icon file of size 32×32 to display along with the preferred solution name and description.
  • Valid file formats are PNG and JPG.
  • I named my logo as Logo32X32.png.

Create an HTML file for license terms:

  • Create an HTML file containing your license terms. You can have an HTML file per language to display the license terms in the user selected language if your app supports multiple languages.
  • These terms are specific to your application. You can search online for the samples.
  • I named my file as TermsOfUse.html

Create Input.xml file:

Content in this file needs to be accurate. Any typo or mistake will cause your AppSource package failure during upload to AppSource.

  • Create an Input.xml file that provides information about your package and the contents of the package.
  • You can download the sample Input.xml from here.
  • Following is Input.xml file, specific to our demo.
    • PackageFile : Should be the name of our pdpkg.zip file (i.e., AppSourceDemo.1.0.0.pdpkg).
    • SolutionAnchorName : Name of the Dataverse solution zip file in the package that is used for the display name and description of solution assets. I have given my Solution1_1_0_0_1_managed.zip which is one of my solution file.
  • Logo and PackageTerm should be the file name
  • Pro tip : Make sure you include file extension (i.e, .zip,.png,.html) in the Input.xml for PackageFile, SolutionAnchorName,Logo and PackageTerm properties any deviation will cause your package fail during certification.
  • For other properties of Input.xml file, refer this link to know more.

Add the items to an AppSource package:

We’ve generated all the required files already. Following is the list.

  • Package file (i.e., AppSourceDemo.1.0.0.pdpkg.zip)
  • [Content_Types].xml
  • Logo (i.e., logo32x32.png)
  • Terms of Use (i.e., TermsOfUse.html)
  • Input.xml

The final step is to add all the components into a single compressed (zip) file, which will be your app source package.

  • Select the files and compress to a zip file.
  • Rename the the zip file appropriately as per your app. Its recommend that you include your company name and app name. For example: Microsoft_SamplePackage.zip.
  • I’ve renamed our AppSource package as Rajeev_DemoAppSource.zip.

Check the AppSource package using AppSource checker:

  • You have an option to test the generated AppSource package file using AppSource checker
  • You need to login with your Office365 credentials.
  • Click on ‘Check your app’. Browse and upload the AppSource package which we generated in above section.
  • Click on ‘Run Check’ to get the results.
  • Our AppSource package is valid, as you can see below, ‘Issues present’ is ‘No issues’.


Model driven app | Update forms and views using table designer (preview)

Conventionally, if you create a new column to a Dataverse table and to reflect the column in the forms and views, you have to manually open each form and view in edit mode, and the column.

With the new Update forms and views preview feature, in one button click, you will be able to add the columns you created to forms and views of this table

What is ‘Update forms and views’ using table designer preview feature:

With this new feature, we can

  • Create columns directly in the table hub or table designer, and use the Update forms and views option.
  • ‘Update forms and views’ option will add the columns to to your forms and views in a single click.
  • You might want to edit the forms or views further to adjust the columns placements.
  • This is a handy feature, if you building a POC or intend to show a quick project feature demos.

In this walkthrough, you’ll learn how to simply add the columns you created to forms and views of this table without manually doing so in the form or view designer.

Steps to use ‘Update forms and views’ feature:

  • Connect to Power Apps maker portal.
  • Create a new table or open an existing table. Click on ‘Edit’
  • Lets create a new column ‘City’ by using ‘+ New column’ button.
  • To add the newly created ‘City’ column to views and forms, click on ‘Update forms and views’. Choose the ‘City’ column from ‘Add these columns’ multiselect dropdown.
  • Choose the forms and views which you would want to add the ‘City’ column to and click on ‘Update’.
  • Once complete, open one of the forms and you will see the ‘City’ column.
  • Following are the ‘Update forms and views’ feature properties.


Categories: CRM

Canvas App | Add Copilot control

In this article, lets learn how to configure and use Copilot control in Canvas Studio.

What is AI Copilot (Preview):

  • Copilot brings AI-powered experience for app users to get insights about the data in their apps through conversation in natural language.
  • With Copilot you can build an app, including the data behind it, just by describing what you need through multiple steps of conversation.

Enable Copilot component in Canvas App studio:

Since its a preview feature, we first need to enable the feature.

  • On the command bar, select Settings > Upcoming features.
  • From the Preview tab, set the toggle for Copilot component to On.
  • Once you enable, you should see the ‘Copilot (preview)’ control in the ‘Insert’ .

Configuring and using the Copilot component:

  • Add the Copilot control to the form.
  • Copilot control requires a data source to be chosen.
  • Currently, only a single Dataverse table can be selected for the Copilot control. I’ve selected ‘Users’ table.
  • Adjust the height and width of the control.
  • Select the specific Fields and/or View that the Copilot control will answer questions for.
  • We can also set the ‘Title’, ‘Data summary’ and ‘Placeholder text’ properties.
  • Play the App and post your questions in a natural language.


Categories: PowerApps Tags: ,

Canvas App | Gallery control | AllItemsCount property

With Power Apps studio 3.23051 version a new AllItemsCount property added to Gallery control.

As per the documentation, Usage of AllItemsCount performance is much faster than calling CountRows function over AllItems.

Using CountRows function:

  • To use CountRows function, you need to pass ‘AllItems’ property of Gallery as a parameter.

Using AllItemsCount property:

  • AllItemsCount is a property of Gallery control and can be referred as below.


Power Apps Studio | Authoring Version

Have you ever encountered a scenario where the most recent features are absent from your PowerApps Studio when developing a Canvas App?

The most possible reason for missing features is that “Power Apps is not available in all regions at once. Instead, each version is made available incrementally in different regions of the world”.

For example, I was looking for ‘AllItemsCount’ property of Gallery control which was introduced in 3.23051 version. If your Power Apps studio is on lower version, you would not get that property.

In this article, let’s explore ‘Authoring Version’, which determine the features accessible within the studio.

How do you know which version you are on?

  • From your Canvas app, click on ‘Settings’.
  • Under ‘Support’ tab, you will find the ‘Authoring Version’ section.
  • To change the version, click on ‘Edit’ and choose the version you would want to go with.
  • Click on ‘Reload + apply version’.

How to get list of features or fixes part of the version:

  • You can find all Power Apps release versions from here.
  • To get Power Apps Studio specific release versions, click here.
  • Click on version link as highlighted below to know about features or fixes released part of the version.
  • For example, clicking on 3.23051 link will take you to following screen.


[Step by Step] Configure and consume ‘Environment Variables’ of type ‘Secret’ using ‘Azure Key vault’

In this article, lets learn the steps to configure Environment Variables of type ‘Secret’ using Azure Key Vault and fetch them from a simple Power Automate Cloud Flow.

Lets first understand what is an Azure Key Vault and Environment Variables.

  • Azure Key Vault is a cloud-based service provided by Microsoft Azure that allows users to securely store and manage cryptographic keys, secrets, and certificates used for protecting sensitive data in cloud applications and services.
  • A secret is anything that you want to tightly control access to, such as API keys, passwords, certificates, or cryptographic keys.

What is an Environment Variable:

  • In simple words, an Environment Variable is a way to store and manage configuration values that can be used across multiple environments.
  • One environment variable can be used across many different solution components – whether they’re the same type of component or different.
    • For example, a canvas app and a flow can use the same environment variable. When the value of the environment variable needs to change, you only need to change one value.

What is an Azure Key Vault:

Now that we know the basics of Environment Variables and Azure Key Vault, lets understand how these two can be used together.

High level design:

Consuming Azure Key Vault secrets in Environment Variables is two step process.

Lets learn the step by step process.

Steps to create new Key Vault and Secrets:

The prerequisite is to register the PowerPlatform resource provider in your Azure subscription.

Register the PowerPlatform resource provider:
  • Select the Subscription and click on ‘Resource providers’ and make sure ‘Microsoft.PowerPlatform’ is ‘Registered’ as shown below.
    • You can use ‘Re-register’ and ‘Unregister’ buttons to either register or unregister.

Create Azure Key Vault:
  • From the Azure Portal, go to Key vaults page and click on ‘Create’ to create a new Key Vault.
  • Provide the details and click on ‘Review + create’ to complete the creation of your new Key vault.
  • Next open the newly created ‘Key Vault’ and create the ‘Secret’ by clicking on ‘Secrets’ tab.
  • Click on ‘+ Generate/Import’.
  • Provide ‘Name’ and ‘Secret value’ and click on ‘Create’.
  • Next is the important step, which is granting ‘Key Vault’ access to the ‘Users/Service Principles’.

Setting Key Vault Access:

Azure Key Vault must have the Key Vault Secrets User role granted to the Dataverse service principal. Follow these steps.

  • Click on ‘Access control (IAM)’ tab and click on ‘Add role assignment’ as shown below.
  • Select ‘Assignment type‘ as ‘Job function roles’ and click ‘Next’.
  • Select ‘Key Vault Secrets User‘ role and click ‘Next’.
  • Click on ‘+ Select members’ and select ‘Dataverse’ under ‘Select members’ pane.
  • Click ‘Review + assign’ button and complete the step.
  • Next, as a last access step, click on ‘Access policies’ tab and click on ‘+ Create’.
  • Select the ‘Get’ permission under ‘Secret permissions’ and click ‘Next’.
  • In the next screen, select ‘Dataverse’ principal and click ‘Next’.
  • On the ‘Review + create’ tab, click on ‘Create’ to complete the step.

Copy the Key Vault details:

We are done with ‘Key Vault’ set up and copy following details, which we need in next steps.

  • From the ‘Overview’ tab, copy ‘Resource group’ and ‘Subscription ID’.
  • From ‘Secrets’ tab, copy the ‘Secret Name’ (i.e.,secUserID) and ‘Key Vault Name’ (i.e., DemoEnvironmentVariables).

We are done with ‘Key Vault’ side of configurations. Lets connect to PowerApps maker portal and set up ‘Environment Variable’.

Steps to configure ‘Environment Variable’ of type ‘Secret’:

From the PowerApps maker portal, create or open an existing Solution.

  • Click on ‘New -> Environment variable’.
  • Select the ‘Data Type’ as ‘Secret’ and click on ‘+ New Azure Key Vault secret reference’ link.
  • Select the ‘Secret Store’ as ‘Azure Key Vault’ and provide the ‘Azure Subscription Id’, ‘Resource Group Name’, ‘Azure Key Vault Name’ and ‘Secret Name’ values which we copied in the previous step.
  • Click on ‘Save’ and you should the newly created ‘Environment Variable’ in your solution as shown below.
  • Copy the name (i.e., raj_evdemosecret) which we need in next step.

We’ve completed the both ‘Key Vault’ set up and creation of Secure ‘Environment Variable’. Its time to create a cloud flow and test.

Create a cloud flow to read the secured ‘Environment Variable’ value:

  • Create a new ‘Instant’ flow.
  • Select ‘Manually trigger a flow’ option.
  • We have a RetrieveEnvironmentVariableSecretValue unbound Action, to read the secret Environment Variable.
  • So, in our flow, Select New step, select the Microsoft Dataverse connector, and then on the Actions tab select Perform an unbound action.
  • Select ‘Action Name’ as RetrieveEnvironmentVariableSecretValue and ‘EnvironmentVariableName’ as the ‘Environment Variable Name’ copied in previous section (i.e., raj_evdemosecret).
  • Save the flow and test. You should see ‘rajeevpentyala@live.com’ which is the secret value we configured in ‘Key Vault’.
  • You will notice a ‘Flow checker’ warning with a message to ‘Turn on secure outputs…’. This is to prevent the output of the action getting exposed in the flow run history.
  • Select  > Settings of  Perform an unbound action control.
  • Enable the Secure Outputs option in the settings, and then select Done.
  • Save the flow and warning in ‘Flow Checker’ should go way now.
  • Retest the flow and you should get outputs as below.

That’s it. Hope you’ve learnt the basics of using ‘Key Vault’ and secret ‘Environment Variables’.

Refer this documentation for more details.


(Preview) Power Pages ALM using solutions

In one of my articles, I’ve explained Power Pages ALM using PAC CLI.

With this new preview feature Using solutions with Power Pages allows you to contain and transport website configurations using standard Power Platform solution concepts.

Feature Capabilities:

This feature includes the following capabilities:

  • Solution explorer embedded experience in Power Pages.
  • Add site(s) to a solution and export/import across environments.

  • Ability to add newly added artifacts on an incremental basis.
  • Use PAC CLI solution command with Power Pages.

Enable this preview feature on Environment:

You’ll first need to enable the enhanced data model on your Power Platform environment before being able to provision a website utilizing the enhanced data model.

  • Select the Upgrade to modern data model for new sites switch from the tool bar as highlighted below.
  • Refer this article for more details.


Categories: Portals Tags: ,

Power Platform | Collaboration feature in model-driven apps

Collaboration feature in model-driven apps, help fusion teams work together to build model-driven apps.

Collaboration comes with 3 features

  • Add comments
  • Copresence
  • Coauthoring (preview)

In this article, I will provide high level details about all the 3 collaboration features. Lets start with enabling the collaboration feature.

Enabling Collaboration in an Environment:

By default, most Power Platform environments have coauthoring enabled by default.

You can enable the feature, from the Power Platform admin center

  • Open the ‘Environment’.
  • Go to Settings -> Collaboration and choose the options.

For this demo, I am going to use following 2 users in my Environment.

Now that we’ve enabled the Collaboration feature at the environment level and have 2 users to test, lets go through the features.

Add comments

  • Comments are notes that are associated with items in your app.
  • Below is an example, providing comments for ‘Main’ group area in my App by 2 users.

  • Comments are stored in a Comment table in Dataverse in the default solution.
  • You can edit your comments or remove existing comments from appearing in the app.
  • You can resolve, or reopen a resolved, comment thread to better track the active comments.
  • Comments in model-driven apps can’t be exported or imported as solution components.
  • You can, however export the Comment table to Excel and then import the Excel file into the environment you want


  • Copresence allows you to find who’s working on an app at the same time.
  • There may be a delay up to 20 seconds between when new members join the app and when you see their presence and location.
  • There may also be a delay up to one minute between when someone saves a change and when you get a notification about the change
  • Instead of copresence, your environment may have coauthoring enabled, which allows app change merges to occur in real-time with seamless collaboration.

Coauthoring (preview):

  • Coauthoring allows multiple makers—whether pro or citizen developers—to make changes to the app at the same time and see those changes in real time.
  • Refer this link to know what you can coauthor in an app.


Power Platform | ‘Security group’ is mandatory to create a new Environment

While creating a Environment on my new Power Platform tenant, I noticed a subtle change.

Following are the steps to create a new Environment.

  • From Power Platform admin center, clicked on ‘+New’.
  • In the ‘New environment’ pane, provided ‘Name’ and ‘Type’ as below and clicked on ‘Next’.
  • In the next section, the ‘save’ button was disabled, which was not the case earlier.
  • The reason is, ‘Security group‘ is a mandatory field to create a new Environment.
  • Even if you don’t have a predefined Security group, you need to select the ‘Open access’ as shown below.
  • Once you select the ‘Open access’ option, you should be able to create the Environment.