Archive for December, 2017

The reply address does not match the configured – Azure ADAL and Dynamics 365

December 27, 2017 Leave a comment

I was building a standalone HTML page which retrieves the Account records from Dynamics 365 and show them in a table.

As a prerequisite, I registered the application in Azure Active Directory’s ‘App registrations’.

OAuth Error - 1

Also configured the Application details in my HTML page

var organizationURI = “https://{orgname}”; //The URL to connect to CRM (online)
var tenant = “{Azure Tenant Name}”; //The name of the Azure AD organization you use
var clientId = “{Application ID}”; //The ApplicationId you got when you registered the application
var pageUrl = “http://localhost”; //The URL of your HTML page in your development environment.

After all the configuration, I was getting below error during the authentication

The reply address “http://…..” does not match the reply address configured for the application.

OAuth Error

Reason and Fix:

  • There must be a ‘Return URL’ configured with your application URL (i.e., HTML url in my case).
  • To configure the ‘Return URL’
    • Connect to ‘Azure Active Directory’ –> App registrations
    • Select your configured Application
    • Under ‘Settings’, click on ‘Reply URLs’
    • Add your application URL (i.e., HTML url in my case)

OAuth Error - 3

  • Rerun the Application and you should be able to connect and get Accounts

OAuth Error - 4

Refer this MSDN article for step by step to connect via ADAL



Categories: Azure, CRM Tags: , , ,

Liquid script to fetch Contact names – Dynamics Portals SaaS

December 26, 2017 Leave a comment

In Dynamics portals (SaaS) to make CRM server calls to retrieve the data we must rely on Liquid Script.

In this article, I am going to retrieve Contacts and loop through to capture Contact ‘Full Name‘ using Liquid Script and display on a Web Template.

Liquid Script - 1

Liquid script to fetch Contacts:

{% fetchxml settings %}
<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”false”>
<entity name=”contact”>
<attribute name=”fullname” />
<attribute name=”telephone1″ />
<order attribute=”fullname” descending=”false” />
{% endfetchxml %}
{% assign result = settings.results.entities %}
{% for item in result %}
{% assign Names = {{item.fullname}} | append: ‘ , ‘ | append: {{Names}} %}
{% endfor %}

// Set the Concatenated text to Span so that it can be read in JScript

<span id=”spanContactNames” style=”display:block”>{{Names}}</span>

Complete Web Template Source:

<html lang=”en” xmlns=””&gt;
<meta charset=”utf-8″ />

function onload() {

// Read Contact names from Span
var spanContactNames = document.getElementById(“spanContactNames”);
if (spanContactNames) {

<body onload=”onload()”>
<h1>**Contact Names**</h1>
{% fetchxml settings %}
<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”false”>
<entity name=”contact”>
<attribute name=”fullname” />
<attribute name=”telephone1″ />
<order attribute=”fullname” descending=”false” />
{% endfetchxml %}
{% assign result = settings.results.entities %}
{% for item in result %}
{% assign Names = {{item.fullname}} | append: ‘ , ‘ | append: {{Names}} %}
{% endfor %}
<span id=”spanContactNames” style=”display:block”>{{Names}}</span>

Note :

  • ‘Liquid Script’ gets executed during the Web Page render and hence the fetched values will be available on Page ‘onload’ script event.
  • ‘Liquid Script’ will respect the Portal security model (i.e., It fetches the records only if you have access granted by your Web Role)

How to test:

  • Create a new Web Template and paste the content to “Source” field.

Liquid Script - 2

  • Add a Web Link and map your Web Template.


Categories: ADX Tags: ,

Dynamics Portals – How to get the configured Portal’s URL

December 19, 2017 1 comment

There was a question posted in my blog on how to get the configured Portal’s URL as someone else configured the portal.

Below are the steps to get your Portal URL.

From your Dynamics 365 Instance:

  • Connect to your Dynamics 365 instance
  • Navigate to Portals -> Website Bindings
  • Open the record and read the URL from “Site Name” field

Portal - URL 3

From your Dynamics 365 Admin Center:

  • Connect to your “Dynamics 365 Admin Center” (i.e., Login to
  • Select your “Dynamics 365” instance
  • Click on “Applications” tab
  • Select “Portal Add-on” and click “MANAGE” button

Portal - URL 1

  • You would be redirected to “Portal” configuration page
  • Copy the URL

Portal - URL 2

Note:  You can access your Portal configurations page, only if your Admin granted access to your login Account. If you don’t have permission, you would end up getting below error message:

You don’t have permission to perform this action. Contact your global administrator to get owner permission for Application ID


Categories: ADX, CRM Tags: , ,

Move Attachments from CRM to Azure Blob – “Attachment Management” tool

December 17, 2017 Leave a comment

Recently I was exploring options to move attachments from CRM (i.e., Notes and Email) to Azure Blob storage and came across “Attachment Management” tool from Microsoft Labs.

This tool can be installed as a solution to your Dynamics 365 instance. Detailed steps and usage guide are available here.

In this article I am going to detail the imperative Azure and Dynamics 365 settings which would avoid the connectivity issues you may encounter during my usage.

Pre-requisites to use this solution:

  • Dynamics 365 instance (You can subscribe for 30 days trail)
  • Enable the “Attachment Management” solution from App Source.
  • Microsoft Azure Account (You can subscribe for trail)
    • Note: You can use the same Dynamics Office 365 account to register for Azure trail account. 

Setting up Azure Storage Account:

Make sure your Azure Storage Account settings matches with below

  • Azure “Storage Account” ‘KIND’ must be “BlobStorage”.

Attachment - Azure Storage Account

  • “Storage Account” Containers ‘Public Access Level’ must be “Blob”.

Attachment - Containers

  • “Shared Access Signature” (SAS token)
    • Set the “Start” to Previous Day as the Azure time zone depends the data Center you choose. (For example, your IST date may be 1 day ahead of your ‘Data Center’ date which may make your ‘SAS token’ invalid)
    • Set the “End” to at least a week ahead of today.

Attachment - Shared Access Signature

Settings in Dynamics 365:

  • With the “Attachment Management” solution you will get 3 entities and a ‘Site Map Area’ (i.e., Azure Attachment Storage)
  • Make sure you configure settings only from ‘Azure Attachment Storage’ site map link and not from ‘Advanced Find’

Attachment - Sitemap

  • In “Azure Blob Storage Setup” page, make sure the ‘Storage Account Name’, ‘Container names’ and ‘SAS token’ matches with Azure settings

Attachment - BlobStorageSettings

  • In “NOTES ATTACHMENT SETTING ENTITY” page, pick your entities and provide correct “Container” name or leave that blank.
    • Note: If you have Dynamics Portal solution installed, uncheck the ‘Web Files’ entity, if its selected.

Attachment - NotesAttachment Page

Troubleshooting steps:

  • After you configure all the settings try adding a Note with attachment to the entity you configured.
  • If you don’t see your attachments move to Azure Container, go to ‘System Settings’ and look for “MicrosoftLabs.AttachmentManagement…..” job for exception.

Attachment - System Jobs


Configure CafeX Live Assist on Dynamics Portals

December 15, 2017 Leave a comment

In this article, I am going to detail the steps to configure ‘Live Assist’ on ‘Dynamics Portals’.

Those who are not familiar with CafeX Live Assist, Live Assist for Microsoft Dynamics 365 Powered by CaféX is a fully integrated omnichannel (i.e., across mobile and web) solution. It provides Chat, Co-browse features.

Note: As we are going to configure ‘Live Assist’ on Dynamics Portals, make sure you have enabled Dynamics 365 portal solution on your Dynamics 365 instance.

To start with, enable the ‘Live Assist’ solution on your Dynamics 365 online instance.

Enable ‘Live Assist’ solution in Dynamics 365 instance:

You can start your ‘Live Assist’ free trail from ‘App Source’

Live Assist - Set up

  • Complete the suggested steps which installs the ‘Live Assist’ solution in your Dynamics 365 Instance.
  • Once you followed the steps, give it few minutes and you should see ‘Live Assist for Dynamics 365’ solution with ‘Installed’ status.

Live Assist - Set up 2

  • Open your Dynamics 365 instance and you should see the ‘CafeX’ tool bar.

Live Assist - CRM

Enable ‘Live Assist’ on Dynamics Portal:

In ‘Live Assist’ scenario, your Dynamics Portal acts as Visitor site and Dynamics 365 works as receiver (i.e., Agent) site, which means, Portal users initiate the chat which will be addressed by CRM User.

Below are the 2 steps to configure Chat window on your Dynamics Portals which allows your Portals User to initiate the chat.

  1. Copy the chat widget script from CafeX site:
  • Check your email inbox for Cafex confirmation mail with CafeX website URL.

Live Assist - Set up email

  • Navigate to the URL and click on ‘GET STARTED’ tab
  • Click ‘COPY’ button to copy the chat widget script.

Live Assist Prtl - 22. Configure Portal Web Template:

  • Go to Dynamics 365 and open the ‘Header’ web template.
  • Paste the widget script you copied in earlier steps.

Live Assist - Header Template

  • Save the Web Template.

We are done with configurations and it’s time to test the Chat.

‘Live Assist’ Usage steps:

  • Open the Dynamics Portal URL and you should see a “Live Chat” button floating.

Live Assist Portal - 1

  • Click the button and start the Chat.

Live Assist Portal - 2

  • Message from Portal will be instantly delivered to CRM Agent.
    • Note: CRM Agent ‘Live Assist’ Status must be ‘Available

Live Assist - 1


Categories: ADX, CRM Tags: , ,

(401) Unauthorized Error – CRM integration with SharePoint

December 12, 2017 Leave a comment

We encountered below exception when we were integrating CRM with SharePoint.

Exception: System.Net.WebException: The remote server returned an error: (401) Unauthorized.

Environment details:

  • CRM 2016 on-premise with Claims authentication enabled.
  • SharePoint Server On-premise with Claims authentication enabled.
  • User Account using to set up is Admin on both the CRM and Sharepoint servers.

Reason & Fix:

Fix suggested in this MSDN Forum worked for us.

It seems there is a known issue/bug with CRM 2016 that doesn’t allow this to work if you try using https in the MetadataEndPoint.

To get this working, you will have to temporarily do the following items before running the SharePoint Power Shell command.

Note : Make sure you note all the existing settings before executing below steps which helps you to roll back, if something goes wrong.


  1. Open the CRM Deployment Manager tool
    • Disable CRM IFD
    • Disable CRM Claims Configuration
  2. Open the IIS and remove the https binding on the CRM Web site and add back the http binding for the CRM Web site.
  3. Run CRM Deployment Manager and change the properties of the deployment for the Web Address to use http instead of https.
  4. Run an IISReset on the CRM Server to ensure this is now accessible via http.
  5. Run the SharePoint PowerShell commands (you should be able to access the MetadataEndpoint using http vs. https now if you put it in the browser (and it should prompt to download a .json file).
  6. Once the SharePoint commands are finished running, you need to reverse the changes above in CRM to re-enable IFD.
  7. Change the CRM Web Address to use https in the CRM Deployment Properties.
  8. Remove the http binding on the CRM Web site and add back the https binding, selecting the correct SSL Certificate.
  9. Run the Configure CRM Claims in the CRM Deployment Manager.  (keep the existing settings)
  10. Run the Configure IFD in the CRM Deployment Manager (keep existing settings).
  11. Run an IISReset on the CRM Server.

Refer MSDN article  which details integrating SharePoint on-premise with CRM on-premise.