Archive

Author Archive

[Step by Step] Data Export Service – Replicate CDS data to Azure SQL Server Database

March 14, 2020 1 comment

For unversed, The Data Export Service (DES) is an add-on service available on AppSource that adds the ability to replicate data to target destinations such as Azure SQL Database and SQL Server on Azure virtual machines.

In this article, lets see how to replicate CDS data to Azure SQL Server Database.

Prerequisites:

  • Subscribe to Dynamics 30 days trial and get Office 365 account.
  • Connect to Power Apps maker portal using Office 365 account and create a simple Model Driven App with ‘Account’ entity.
  • Install ‘Data Export Service’ add-on from AppSource.
  • Subscribe to Azure 30 days trial using the same Office 365 account.

DES_5

  • Azure SQL Server and Database.
  • Generate Azure Key Vault URL using Power Shell.

Installing ‘Data Export Service’ from AppSource:

  • From your Model Driven App, go to Settings -> Microsoft AppSource
  • Search for ‘Data Export Service’ and click on ‘Get it now’.

DES_1

  • In the next steps, select your Organization and click on ‘Agree’.

DES_3

  • Wait for the solution to get installed.

DES_4

Configuring Azure SQL Server and Database:

  • Connect to your Azure Portal and create a new SQL Database Server  resource.

DES_6

  • Post creation, copy the ‘Server name’ and ‘Server admin’ and ‘Subscription ID’, which you would need in next steps.

DES_7

  • Now we need to create a new Database where you would replicate your CDS data to.
  • You can either create new Database from Azure Portal or from SQL Server Management Studio (SSMS). I am using SSMS to create the new Database.
  • Connect to Azure SQL server from SSMS using ‘Server name’ and ‘Server admin’ details captured in previous steps.

DES_9

  • Create a new Database and copy the name (i.e., DES in my case).

DES_10

  • Now go to Azure Portal and open the DES SQL database. Click on ‘Connection Strings’.

DES_11

  • Copy the ‘ADO.NET’ connection string which you would need in next steps.

DES_12

Generate Azure Key Vault URL using Power Shell and create Export Profile:

  • To connect to Azure SQL Server Data Export Service(DES) requires the SQL Server connection string.
  • DES will not accept the plain connection string.
  • DES accepts only Azure key vault URL with connection string stored as Secret.

As a standard practice, we configure Azure Key Vault URL using PowerShell script using following steps:

  • From the Model Driven App, go to Settings -> Data Export
    • Note: Make sure you disable pop-up blockers.
  • Click on ‘+New’ to create ‘Export Profile’.

DES_13

  • From the pop-up, fill the details other than ‘Key Vault URL’ and click on information icon.

DES_14

  • Copy the PowerShell helper script from the pop-up.

DES_15

  • Now open the ‘Windows PowerShell’ and open a new window.
  • Paste the PowerShell helper script copied from previous step.
  • In the ‘PLACEHOLDER’ section provide the details specific to your Azure subscription.
    • $subscriptionId – Use the copied value from previous steps.
    • $keyvaultName – Your desired name.
    • $secretName – Your desired name.
    • $resourceGroupName – Either use existing or new. If a resource group doesn’t already exist a new one will be created.
    • $location – provide the location (i.e., East US/West US/…)
    • $connectionString – Use the copied value from previous steps.
    • $organizationIdList – Dynamics organization ID. From the Model Driven App, go to Settings > Customizations > Developer Resources. The organization Id is under ‘environment Reference Information’.
    • $tenantId – You can get it from ‘Azure Portal -> Azure Active Directory -> App registrations -> Endpoints‘ by copying the highlighted value as below.
    • DES_16
  • Once all the required details provided, your PowerShell looks as below.

DES_17

  • Run the script which creates a new Azure Key Vault. You should get output as below.

DES_18

  • Now that the ‘Key Vault URL’ is formed, copy the value from Azure Portal -> Key vaults -> Secrets’

DES_19

  • Go back to the DES ‘Data Export Profile’ pop up and paste the ‘Key Vault URL’.
  • Click on ‘Validate’ to make sure the connection works.

DES_24

  • Click ‘Next’ and pick your CDS entities which would want to replicate to Azure SQL.

DES_29

  • As a last step click on ‘Create & Activate’ to complete the set up.

DES_30

  • Give it sometime and you should see the Metadata tables and ‘Account’ entity tables created in your target (i.e., Azure SQL Server).

DES_31

Notes:

  • Data Export Service can be used with model-driven apps in Dynamics 365, such as Dynamics 365 Sales and Customer Service.
  • Only entities that have change tracking enabled can be added to the Export Profile. Enable change tracking to control data synchronization
  • To use the Data Export Service the model-driven apps in Dynamics 365 and Azure Key Vault services must operate under the same tenant and within the same Azure Active Directory.
  • The Data Export Service does not drop (delete) the associated tables, columns, or stored procedure objects in the destination Azure SQL database when the following actions occur and these items must be dropped manually.
    • An entity is deleted.
    • A field is deleted.
    • An entity is removed from an Export Profile.

Refer article to know more about Data Export Service. To troubleshoot connectivity issues refer article

🙂

Canvas App -Working with Bing Maps connector

In this article lets understand the basics of ‘Bing Maps‘ connector to locate the addresses in Canvas App.

Prerequisites:

  • Subscribe to Dynamics 30 days trial and get Office 365 account.
  • Connect to Power Apps maker portal using Office 365 account to build the Canvas App.
  • Bing Map API Key

How to get Bing Map API Key:

  • Connect to Bing Maps Portal
  • ‘Sign In’ using either ‘Microsoft Account’ or ‘Enterprise Azure Active Directory account’.

bm_1

  • Go to ‘My account -> My Keys’ and create a new key. (Steps to create new key)
  • Copy the Key which we gonna use in next steps.

bm_2

Adding ‘Bing Maps’ connector to Canvas App:

  • Create a new Canvas App.
  • Add a ‘Bing Maps’ connector.
  • Provide the ‘API Key’ captured previously.

bm_3

Locate address using ‘Bings Maps’ connector:

  • For better understanding, I added below controls to my Canvas app’s screen.
    • 3 Text box controls to capture address
    • An Image control which loads the map
    • A Button to load the map.
  • On Button ‘OnSelect’, Declare a global variable ‘varAddress‘ and use BingMaps.GetLocationByAddress API to convert the address to coordinates (i.e., Latitude and Longitude).
    • Set(
      varAddress,
      BingMaps.GetLocationByAddress(
      {
      addressLine: txtAddress1.Text,
      locality: txtAddress2.Text,
      postalCode: txtZip.Text
      }
      )
      );

bm_4

  • Now use the coordinates from ‘varAddress‘ variable and load the map in Image control.
  • Set ‘Image’ property to BingMaps.GetMap() by setting coordinates from ‘varAddress’.
    • BingMaps.GetMap(
      “AerialWithLabels”,
      15,
      varAddress.point.coordinates.latitude,
      varAddress.point.coordinates.longitude)

bm_5

  • Run the App and you should see the address located in Map.

bm_6

  • You can also show a ‘Push Pin’ using ‘pushpin’ property. You need to pass coordinates as below.
    • BingMaps.GetMap(
      “AerialWithLabels”,
      15,
      varAddress.point.coordinates.latitude,
      varAddress.point.coordinates.longitude,{pushpin:varAddress.point.coordinates.latitude&”,”&varAddress.point.coordinates.longitude}
      )

bm_7

🙂

Categories: PowerApps Tags: , ,

PL-900: Microsoft Power Platform Fundamentals – Prep Notes

February 25, 2020 Leave a comment

There was an ask form a Power Platform beginner in my blog about the preparation for the PL-900 exam.

As I attained the certification recently, I am going to share the topics I covered for my preparation in this article.

***This article is strictly for guidance purpose and by no means I intend to post the questions from the exam***

Areas I covered during my preparation:

  • Power Platform Environments
    • Types of Environments
    • Use of Default Environment
    • Built-in Roles – Admin Role, Maker Role
  • Canvas Apps vs Model Driven Apps
    • Understand that ‘Model Driven Apps’ can only consume CDS data.
    • You need Canvas app for other types of data.
  • Data Connectors
    • Tabular data and Functional-based data connectors
  • Power Automate Flow
    • How you post CDS data to SAP/Saleforce/etc
    • Integrate Flow with Canvas and Model Driven Apps.
    • How to test the Flow.
  • Power Apps Portals
    • Understand the basics of Web Page, Web Role, Web Templates.
  • AI Builder
    • Understand what you can achieve with the 4 models.

PL900_1

  • Power BI
    • Power BI Desktop vs Power BI Service : What can and can’t be done with each.
    • Data Modeling.
    • How to create and share Dashboards.

If any further questions or need guidance feel free to leave a comment.

🙂

 

Categories: CRM, PowerApps Tags:

ADX Portal – Forgot Password – ‘Invalid Party Object Type’ Error

February 21, 2020 2 comments

Few of our ADX portal users encountered an unhandled exception while resetting the Password using native ‘Forgot Password’ feature.

ADX_FgtPwd_1

Reason:

  • Its a sporadic issue only with few portal users.
  • When checked the ‘Event viewer’ logs on Portal’s web server, there was this following warning with ‘Invalid Party Object Type 9’ exception message.

ADX_FgtPwd_2

  • In CRM, ‘Object Type 9’ denotes OOB ‘Team’ entity and the issue turns out to be with the ‘From’ field of ‘Send Password Reset To Contact‘ ADX process.
  • In our requirement, we were setting ‘From’ field of ‘Send Password Reset To Contact’ process to owner of the ‘Portal User’ (i.e.,Contact).
  • Portal user’s (i.e.,Contact) who owned by teams encountering this issue while triggering ‘Forgot Password’. As Email can’t be delivered when a ‘Team’ set as ‘From’.

Fix:

  • Modified the ‘Send Password Reset To Contact‘ process by setting ‘From’ field to a ‘System User’ with Mail Box enabled. This made sure no ‘Team’ renders in ‘From’ field.

ADX_FgtPwd_3

🙂

 

Power Apps – Minimum privileges to run app

February 20, 2020 4 comments

To configure a security role with minimum privileges to run an app, a pre-packaged unmanaged solution is available in Microsoft download center and can be downloaded from here 

The solution contains a security role by name ‘min prv apps use‘.

MinPrivRole

Use ‘min prv apps use‘ security role as a reference and copy to a new role and configure additional privileges as per your business needs.

🙂

Power Apps – ‘Environment Variables’ and their usage in Canvas Apps

February 18, 2020 Leave a comment

Lets take a scenario, where you would want to pass a 3rd party API URL to your plug-in which changes every quarter. Couple of options to pass the URL to plug-in are either pass the URL as ‘Secured/Unsecured parameters’ or Create an entity and store the API URL and fetch from plug-in using Query Expression.

Using ‘Environment variables’, which is Power Apps preview feature currently, we can configure the input parameters allow management of data separately compared to hard-coding values.

Up on creating ‘Environment variable’, a new record gets added to both OOB ‘Environment Variable Definition’ entity and ‘Environment Variable Values’ entities.

‘Environment Variable Values’ is child to the ‘Environment Variable Definition’ entity.

We can refer records from these OOB entities in plug-ins or Canvas Apps or Power Automate just like any other entities.

In this article, lets see how to create ‘Environment Variables’ and use them in Canvas App.

Prerequisites:

  • Subscribe to 30 days trial and get Office 365 account.
  • Connect to Power Apps maker portal using Office 365 account.

Create a new ‘Environment variable’:

  • From Power Apps maker portal go to ‘Solutions’ tab.
  • Either create a new solution/Open Existing solution.
  • From ribbon, click on New -> Environment variable
    • In the ‘New environment variable’ pane, provide ‘Display Name’ and choose ‘Data Type’.
    • Provide either ‘Default Value’ or ‘Current Value’

EV_1

  • Save. I’ve created a ‘Text’ variable with an environment URL as ‘Current Value’.

EV_2

  • I’ve configured a Model driven app with ‘Environment Variable Definition’ entity added to the ‘Site Map’ to check the created ‘Environment variable’ record.

EV_3

  • Open the Model driven app and go to ‘Environment Variable Definition’ and you will see the record.

EV_4

Using ‘Environment variable’ in Canvas app:

As the ‘Environment variable’ stores in ‘Environment Variable Definition’ and ‘Environment Variable Values’ entities, we can add these entities from ‘Data sources’.

  • Create a new Canvas App.
  • Add ‘Environment Variable Definitions’ and ‘Environment Variable Values’ entities as Data sources.

EV_6

  • Add a Label to display the ‘Environment variable’ value.
  • Use ‘LookUp’ function to get the specific ‘Environment variable’ filtered by ‘Display Name’.
    • LookUp(‘Environment Variable Values’,’Environment Variable Definition’.’Display Name’=”AppURL”).Value
    • In the above formula, ‘AppURL’ is my ‘Environment Variable’ display name.
  • The value would be fetched and set to the Label text.

EV_7

Managing ‘Environment variables’:

  • Environment variables can be created and managed through the modern solution interface or by using code.
  • A separate JSON file is created within your solution package for the values, which can also be managed in source control and modified in a build pipeline.
  • When you export the solution, a json file ‘environment_variable_values’ will be available.

EV_8

  • Open the file and the ‘Environment Variables’ render as json records.

EV_9

  • Export to and import from Excel is also supported.

🙂

 

 

 

ADX Portal – Display ‘Message’ during maintenance window

February 14, 2020 Leave a comment

There might be times when your Portal is under scheduled maintenance or is down due to temporary outage. When a user accesses the portal during maintenance, unpredictable behavior and intermittent unavailability might be experienced.

In ADX portal we can display a message to users during a maintenance activity by following below steps:

  • Create a HTML page with the message you would want to display.
  • Save it as ‘App_Offline.htm‘.
    • Make sure the name of the file is exactly same.
  • Place this file in root folder of ADX website.

Portal_Maintainence_1

  • ADX always opens ‘App_Offline.htm’ page, if it finds in root folder.
  • Hit the portal URL and you would get the ‘App_Offline.htm’ page, which displays your maintenance message.

Portal_Maintainence_2

🙂

 

Categories: ADX Tags: ,

PowerApps Portal – Enable Maintenance mode

February 13, 2020 Leave a comment

During a scheduled maintenance or due to a temporary outage, If you want to bring down your portal and display a proper message to users, PowerApps portal has “Enable Maintenance mode” option.

In this article lets see how to use ‘Enable Maintenance mode’ option.

Prerequisites:

  • Subscribe to 30 days trial and procure an Office 365 account.

Steps to navigate to Portals admin center:

  • Connect to Power Apps maker portal using Office 365 account.
  • Create a new PowerApps portal app, if you don’t have already.

PPortal_Maintainence_6

  • Now from the ‘Apps’ tab, select your portal and go to ‘Settings’.

PPortal_Maintainence_2

  • From the ‘Portal settings’ pane, click on ‘Administration’ link.

PPortal_Maintainence_1

  • You will be redirected to ‘PowerApps Portals admin center’.

PPortal_Maintainence_3

Enable/disable Maintenance mode:

  • Select ‘Portal Actions’ tab and click on ‘Enable maintenance mode’

PPortal_Maintainence_4

  • You get the ‘Enable maintenance mode’ popup.

PPortal_Maintainence_5

  • Under Select page to be used when maintenance mode is enabled: Select one of the following values:
    • Default page: Select this value if you want the default page to be displayed. By default, this option is selected.
    • Custom page: Select this value if you want a custom HTML page to be displayed.
      • Custom page URL: You must ensure that the page URL you provide is publicly accessible. 
  • I opted ‘Default page’ option and clicked on ‘Enable’.
  • If you browse the portal, you would get following screen:

PPortal_Maintainence_7

Notes:

  • When the maintenance mode is enabled, the customers are restricted from browsing any webpages except the <portal URL>/_services/about page.
  • If you opt for ‘Custom page’ option, make sure, the custom page you provided should not contain the x-frame-options:SAMEORIGIN response header, else the page will not load.

🙂

 

Power Platform – Pass external API collection from Power Automate to Canvas App

February 9, 2020 1 comment

In this article, lets see how to pass an external API’s json collection from Power Automate(Formerly ‘Microsoft Flow’) to a Canvas application.

For this example, I am going to use ESRI  mapping service API, in my Power Automate Flow. Refer here to know more about ESRI. You may also use other APIs as per your convenience.

ESRI API is url based and returns the ‘Address Suggestions’ in json format.

Flow_Json_3

Before we start lets make sure to meet all the prerequisites.

Prerequisites:

  • Subscribe to 30 days trial and get Office 365 account.
  • Connect to Power Automate portal using Office 365 account to build Power Automate flow.
  • Connect to Power Apps maker portal using Office 365 account to build the Canvas App.
  • ESRI api URL – Refer my previous article on the usage of ESRI or you can simply use this url

Once all prerequisites are met, here is the high level design:

  • Create a new Power Automate flow and call ESRI API to fetch Address Suggestions.
    • You can take any open API which returns json collection.
  • Parse the ESRI API Response to json collection.
  • Create a new Canvas app
  • Trigger Power automate flow from Canvas App and read the collection.

Lets get started.

Steps to configure the Power Automate Flow:

  • Connect to Power Automate portal
  • Create a new ‘Instant flow’ by selecting the right Environment.

Flow_Json_1

  • Provide a name ‘GetAddressSuggestions’ and select trigger as ‘PowerApps’

Flow_Json_2

  • To call ESRI api, add a new ‘HTTP’ action.

Flow_Json_4

  • Choose Method as ‘GET’ and in URI paste the ESRI url as mentioned in prerequisite section.

Flow_Json_5

  • Next, we need to parse the response from ESRI api. As the ESRI results would be in json format, add ‘Parse JSON’ action.

Flow_Json_6

  • In ‘Parse JSON’ action,
    • set Content as ‘Body’ from HTTP action.
    • Next we need to provide the json schema of ESRI response. To do that, click on ‘Generate from sample’.
    • Flow_Json_9
    • Now copy the response from ESRI API (Copy the browser’s output using ctrl+a+copy)
    • Flow_Json_7
    • Paste in the ‘Insert a sample JSON Payload’ window and click ‘Done’.
    • Flow_Json_8
    • If no warnings, your ‘Parse JSON’ pane should look as below.
    • Flow_Json_10
  • As we completed the ESRI response capture and parsing to json, now we need to pass the captured json response to Power App.
  • To pass the json response to Power App, add a new ‘Response’ action.

Flow_Json_11

  • In the ‘Response’ pane,
    • Set the ‘Body’ to ‘Body’ from ‘Parse JSON’.
    • Flow_Json_12
    • Expand ‘Show advanced options’ and click on ‘Generate from sample’.
    • Copy the response from ESRI API and paste in the ‘Insert a sample JSON Payload’ window and click ‘Done’. (Same step like we did in ‘Parse JSON’ pane).
    • ‘Response’ pane should look as below with no warnings.
    • Flow_Json_13
  • Run the flow and make sure it ran successfully.

Flow_Json_18

Steps to configure the Canvas App:

As we completed the Power Auto Flow, now its time to consume the Power Automate flow response from Canvas App by following the steps below

  • Connect to Power Apps maker portal using the same Office 365 account.
  • Create a new Canvas App.
    • Note: Make sure the same Environment used for Power Automate is selected.
  • Add a new button.
  • Select the button, from the ribbon menu, click on ‘Action -> Power Automate’.
  • From the pane select the ‘GetAddressSuggestions’ Power app flow.

Flow_Json_14

  • After few seconds, you would see the Run() command auto populated as below.

Flow_Json_15

  • As we going to get json collection from flow, lets capture the json collection to a collection variable ‘collAddress’ using ‘ClearCollect()’. Refer article to know more about ‘ClearCollect()’.
  • With the ClearCollect() and Run() functions, the final ‘OnSelect’ statement should look as below.

Flow_Json_16

  • Lets run the App and click on the button. Application takes couple of minutes to complete the run.

Flow_Json_17

  • Post run, check the collection returned from flow by going to ‘File -> Collections’ tab.

Flow_Json_19

  • You can also add a ‘Data table’ control and display the results returned from flow as below

Flow_Json_20

🙂

 

Power Platform – Pass json collection from Canvas App to Power Automate

February 9, 2020 1 comment

Refer my previous article for steps to pass json collection from Power Automate to Canvas App.

Now lets see how to pass json collection from a Canvas app to Power Automate flow.

Before we start lets make sure to meet all the prerequisites.

Prerequisites:

  • Subscribe to 30 days trial and get Office 365 account.
  • Connect to Power Automate portal using Office 365 account to build Power Automate flow.
  • Connect to Power Apps maker portal using Office 365 account to build the Canvas App.

Once all prerequisites are met, here is the high level design:

  • Create a new Canvas app.
  • Prepare a json collection.
  • Create a new Power Automate flow.
  • Trigger Power automate flow from Canvas App by passing the collection as parameter.
  • Read the json collection from Power Automate flow.
  • Create ‘Contact’ records in CDS.

Lets get started.

Steps to configure Canvas App:

  • Connect to Power Apps maker portal using the Office 365 account.
  • Create a new Canvas App.
    • Note: Make sure the same Environment used for Power Automate is selected.
  • Add a new button ‘Generate Sample Collection’.
  • On button’s ‘OnSelect’ prepare a json collection using ‘ClearCollect’ function as below.

Flow_Json_21

  • Once your run the App and click ‘Generate Sample Collection’ button, you should see the collection from ‘File -> Collections’ tab.

Flow_Json_22

Steps to configure the Power Automate Flow:

  • Connect to Power Automate portal using the same office 365 credentials used to connect to Power App portal.
  • Create a new ‘Instant flow’ by selecting the right Environment.

Flow_Json_1

  • Provide a name ‘GetCollectionFromPowerApp’ and select trigger as ‘PowerApps’.
  • Now, we need to read the collection passed from Canvas app to a variable. Lets add a new ‘Initialize Variable’ action.
  • In the ‘Initialize Variable’ action,
    • Provide variable name by setting ‘Name’ field. I set it as ‘collPersons’.
    • Type: String
    • Select ‘Value’ and click on ‘Ask in PowerApps’. A auto generated name would appear and select the same.
    • Flow_Json_25
  • Once we receive the collection and stored in a string variable ‘collPersons’, next we need to parse in to json collection.
  • Add a new ‘Parse JSON’ action.
  • In ‘Parse JSON’ action,
    • set Content as ‘collPersons’ from ‘Initialize Variable’ action.
    • Next we need to provide the json schema coming from Canvas app. To do that, click on ‘Generate from sample’.
    • Copy the json collection formed in Canvas app using ClearCollect function and paste as below.
    • Flow_Json_27
    • If no warnings, your ‘Parse JSON’ pane should look as below.
    • Flow_Json_28
  • Now we got json collection parsed and we are good start final step, creating records to CDS.
  • Add ‘Create a new record’ CDS action and select the ‘Environment’ and ‘Entity Name’

Flow_Json_33

  • Set the attributes (Last Name and Email) from ‘Parse JSON’ action.

Flow_Json_34

  • Once you set variables in ‘Create a new record’ CDS action, flow would automatically wrap the action in ‘Apply to each’.

Flow_Json_29

Trigger the Power automate flow from Canvas App:

Now we have Power automate flow with the logic to read and parse the json collection and add them to CDS as Contact records, lets trigger the flow from Canvas App.

  • Open the Canvas app created in above sections.
  • Add a new button ‘Share Collection To Flow’
  • Select the button, from the ribbon menu, click on ‘Action -> Power Automate’.
  • From the pane select the ‘GetCollectionFromPowerApp’ Power app flow.
  • After few seconds, you would see the Run() command auto populated. Now pass the ‘collPersonalInfo’ collection wrapped in JSON() function.
    • JSON() function is required to convert the ‘collPersonalInfo’ collection to JSON string as the Power Automate flow expects ‘String’ variable as first action.
  • Finally ‘OnSelect’ should look as below.

 

Flow_Json_30

  • Now run the App and click ‘Share Collection To Flow’ button, post run, go to Power automate flow’s history and you should see it ran successfully.

Flow_Json_31

🙂

Categories: CRM, PowerApps Tags: ,