Monday, June 19, 2017

Using Postman and the Dynamics 365 Web API

All applications performing external requests to the Dynamics 365 (online) web API first need to be registered with Microsoft Azure Active Directory to be able to authenticate using OAuth. The same also applies to Postman – for those of you who don’t know Postman, it is a pretty handy utility which allows you to perform for example REST calls without the need to write code.

For a detailed discussion about registering apps in Azure see Walkthrough: Register a Dynamics 365 app with Azure Active Directory (it still uses screenshots from the old Azure Portal but overall the steps are still valid).

To register Postman as an external application I followed these steps:
  • Select the Azure Active Directory  in which you need to register your app (Remember you can link multiple Azure Active Directories to a single Azure subscription)
  • When using Postman, you can register a native app and provide a Redirect URI - enter a value specific to your application e.g. http://localhost/postmand365app
  • Once you have registered your application, AAD will assign your application a unique client identifier (this is the ApplicationId which is listed the screenshot below. )

  • Create a secret key for your Azure app registration – make sure that you copy the key value since it will only be visible on the first save.
  • Give your application the necessary rights to connect through to CRM. Since you don’t want to show the oAuth consent screen, you want to grant the application the necessary consent. As an administrator, you can  consent to an application's delegated permissions on behalf of all the users in your tenant by clicking on the “Grant permissions” button.

If you did not correctly complete the previous steps, you will probably see some errors around invalid grants later on as shown in the next screenshot.

You have now completed all the necessary preparation  - now you need to construct the POST request to retrieve the bearer token which needs to be used in subsequent requests to Dynamics 365. You will need to do a request to{tenantid}/oauth2/token – where tenantid is the Azure Active Directory Tenant Id.  You can retrieve this in the Azure Portal, if you click on the Help icon in the upper right and then choose 'Show Diagnostics' – this will show the the diagnostic JSON which also contains the tenantid.
  • Header:
    • Cache-control: no-cache
    • Content-type: application/x-www-form-urlencoded
  • Body
    • client_id: the ApplicationId you saw in Azure AD
    • resource: (CRM tenant url)
    • username and password:  ... 
    • grant_type: password
    • client_secret: the secret key value that you got from Azure app registration
I use Postman variables (see Using variables inside postman and collection runner) for a number of these values e.g. username, password,etc … as visible in the screenshot below. To see if everything works correctly, click on send, in the response you will see an access token that you need to use in calls to the CRM Web API.

To make this easy to use add the code snippet below to the Tests tab – this will save the access_token returned to an environment variable.
var json = JSON.parse(responseBody);
postman.setEnvironmentVariable("bearerToken", json.access_token);
To validate that this worked correctly click on the “Eye” icon in the upper right corner and you will see a “bearertoken” environment variable which can be used for subsequent requests.

To make a web request using this token using the header values below -  this will continue to work until the token expires and then you simple get a new one, by executing the request to{tenantid}/oauth2/token and you will be able to run your requests directly within Postman.

Thursday, May 11, 2017

Save storage cost in Dynamics 365 (online) with Attachment Management solution

When files are attached/linked to Dynamics 365 records, they are stored in the CRM database which will have an impact on licensing cost depending of how much this functionality is being used. In Dynamics 365, 10 GB of storage is by default allocated to all CRM databases - for all organizations in the tenant) and 5GB is accrued per 20 full-users which are being licensed. (For more details see the Dynamics 365 Enterprise Edition Licensing guide). It is however possible to purchase additional database storage at roughly  4 EUR/GB/month. So if you accumulate 100 GB of files/documents per year – the cost might quickly rise – listed below is a rough estimate for 3 years.
Required storage Yearly cost
Year 1 100 GB € 4.800
Year 2 200 GB € 9.600
Year 3 300 GB € 14.400
There are a however a  number of options to externalize these documents/file blobs outside of the CRM databases and save money:
  • Use SharePoint Online as document storage – see Using SharePoint Online to store Dynamics CRM Online Documents for more details. This is the preferred solution if you also need to leverage SharePoint features such as document metadata, authoring/editing of Office documents, version management, etc… From a user perspective, this might however be a way of working which is not as smooth as expected.
  • Use Azure Blob storage to store your documents/files  - Azure Blob storage will roughly cost between 0.02 and 0.05 EUR/GB/month depending on reequired redundancy and type of storage (for an exact pricing  ). You will off course still need a solution to externalize these blobs. You can develop your own solution (you can use as a starting point) or purchase a third party add-on such as ProStorageSaver from ProMX which will store attachments within Azure Blob Storage. Recently there is however a new solution available from Microsoft Labs on Appsource – Attachment Management
The Attachment Management solution is an add-on feature to dynamics 365 CRM Online to manage notes and email attachments using Azure blob storage. Attachment Management  not only  enables business users to optimize use of CRM Online storage but it also offers additional optional features using web resources such as multiple files upload with drag and drop support as well as  a web resources which allows to list all notes and email attachments in grid format, with download and preview of these attachment.

Figure 1. Screenshot of upload files control with drag and drop support

Figure 2. Grid view with e-mail and note attachments (including preview error)

This is a preview solution and there are still some issues:
  • Menu item for "Azure Blob Storage Settings" did not appear underneath Settings>Extensions – you can however manually add it through customization
  • Preview of documents within the grid listing does not seem to work correctly as visible in figure 2 above.
You also have to keep in mind that if you already have some existing attachments in Dynamics 365 (online), you will have to write some code to move them to Azure blob storage in the same way as the current solution does since this is not supported in the current version.

Monday, May 01, 2017

Dynamics 365 weekly reading list 01/05/2017

Lots of interesting news on Dynamics 365 the last couple of weeks – keep up to date by subscribing to this blog.

Technical topics (Configuration, customization and extensibility)

Topics for business analysts and power users

Monday, April 24, 2017

The Dynamics CRM consultant tool belt

To be truly productive as a Dynamics CRM consultant you need a good toolkit to automate tedious or labor-intensive tasks. While you can solve anything by writing code – it just gets a lot easier when you can leverage the tools built by the CRM community. Listed below are the tools which I have used in the last 12 months – leave a comment if you think I have missed an essential utility in your tool belt.

  • Ribbon workbench for Dynamics CRM  - the standard for editing the Dynamics CRM Ribbon since CRM2011, it can now also be installed as a plugin for XRMToolbox
  • XrmToolBox – the Swiss army knife for CRM consultants, it is a windows application on which 30+ plugins can be added to automate a number of tasks – listed below are some of the XrmToolBox plugins I have recently used
    • Metadata Document Generator: a tool to generate Excel and Word documents with entities and attributes information - also take a look at  Spring Cleaning for your Dynamics CRM system about how you can use it to clean up your CRM system
    • Script Finder: lists all client events defined in an organization
    • Solution History for CRM 2013/2015/2016: allows you to view a historical list of solutions that have been imported, as well as display how many times a solution has been imported, version number that was updated and error/warning messages that were encountered during solution import
    • FetchXML Builder: Build and test FetchXML with all capabilities supported by the CRM platform, etc …
  • CRM Diagnostics Toolkit
  • Trace reader for Dynamics CRM (Codeplex)  
  • Level Up for Dynamics CRM (Chrome extension) 
  • Random test data generator 
  • Dynamics CRM/365 Developer Extensions - is a very worthy replacement of the SDK Developer Toolkit. It contains a lot of templates and will accelerate your development of plugins and workflows
  • CRM Rest Builder – a tool to generate Javascript code using the 2011 & Web API REST endpoints
  • XRM CI Framework - provides you with the tools automate the build and deployment of your CRM solutions. Use the framework to implement a fully automated DevOps pipeline, which will allow you to deploy more frequently with greater consistency and quality.
  • Fake XRM Easy – unit test library for Dynamics CRM/365 plugins and workflows
  • ConfigDataMover – Tool used for synchronizing data in different CRM environments (from @lucas_is)
  • Dynamics 365 workflow tools – this solution contains 30+ workflow activities which will help you to be more productive when designing Dynamics 365 process (from @demian_rasko )

Also check out these other tool lists – Your essential toolkit for Dynamics CRM (from @jukkan)

Thursday, April 20, 2017

Getting a head start developing Dynamics CRM plug-ins

In this article I will explain what Dynamics CRM plug-ins are and which tools you can use to speed up the development of CRM plug-ins. The goal of this article is not to explain the logic behind plug-ins in detail, you can look a the links outlined in the references section of this blog post for that. I will however provide you with the most important information to get you started building your first Dynamics CRM plug-in with Visual Studio 2015 using the different tools : Microsoft Dynamics CRM SDK Templates, Microsoft Dynamics 365 Developer Toolkit, Dynamics CRM & 365 Developer Extensions or JonasPluginBase

A plug-in is an event handler (packaged as a .NET assembly) that can be used to intercept events generated from the  Dynamics CRM system, to perform a number of actions in code.  Apparently the underlying architecture of plug-ins has not changed a lot since Dynamics CRM 2011 so developers who have building these for previous versions can still use the same code base. So in essence plug-ins are .NET classes that implement the Microsoft.Xrm.Sdk.iPlugin interface. One or more plug-in classes can be contained in a .NET assembly (class library) – so you can just create a new class library project, add a reference to the Microsoft.Xrm.Sdk.dll (part of the SDK), add a class which inherits from Microsoft.Xrm.Sdk.iPlugin and implement the Execute method. You will also need to add to sign your assembly with a strong name.

But to let CRM know that your code needs to run, you will need to register your assembly to be invoked as part of the message execution pipeline that occurs when a CRM message is being processed. So first you will need to define on which type of message you want to react (e.g. associate tasks upon creation of a new account, setting default values, etc …) – these can be common messages such as create, retrieve (read), update or delete but also specific messages such as AddToQueue. Most message types are available for extension but there are some exceptions – check out Supported messages and entities for plug-ins.

Another design decision that you have to make when registering your plug-in, is whether it needs to run synchronously or asynchronously. Do realize that the choice between synchronous or asynchronous is also defining at which stage you can register your plugin e.g. an asynchronous plugin will only run post-operation and is not part of the database transaction (See Event execution pipeline for more details about the different stages).

The third design decision you will have to make, is deciding where your code will execute – Dynamics CRM provides two different options:
  • Full-trust (or non-isolated): synchronous plugins will run within the W3WP.exe process of IIS, and asynchronous plug-ins in the AsyncService which host the process. This is only possible in on-premise deployment and although slightly faster you will loose the benefits of …
  • Sandbox execution (or isolated mode): executes in the Microsoft.Crm.Sandbox.Workerprocess.exe process This should be your default choice unless you have a good reason not to use sandbox execution. This is the only option for CRM Online deployment but also has some limitations such as a two minute execution limit but also provides some benefits such as collection of run-time statistics about plugins-ins and custom workflow activities that run in the sandbox.  – I recommend that you read Plug-in isolation, trusts and statistics for more information as well as Understanding plugin sandbox mode.
To actually built the logic for your plugin you will need to use iPluginExecutionContext which provides information about the execution of the plugin such as (See Understand the data context passed to a plug-in for more information)
  • MessageName: name of the message in this case Create
  • Stage: stage that a plugin is being invoked e.g. 20 for Pre-Operation
  • PrimaryEntityName: name of the entity that triggered this message e.g. “lead”
  • InputParameters: Parameters from the request message – e.g. for a createrequest there is parameter of type “target” which contain
  • OutputParameters: Response message after the operation has completed
The next code sample shows how you use the PluginExecutionContext and how you leverage interfaces such as iTracingService (Provides a method of logging run-time trace information for plug-ins) and iOrganizationServiceFactory which allows you to create an instance of the organization service.

Option 1 : Dynamics CRM SDK Templates
As you noticed there is a quite a lot of plumbing code needed before you can get started. Fortunately there are alternative ways to start coding your CRM plugins such as the Microsoft Dynamics CRM SDK Templates (also part of the Dynamics CRM 2016 SDK). This provides a Visual Studio project template with a pluginbase class so that a lot of the repetitive plumbing code can be eliminated.

Option 2: Microsoft Dynamics 365 Developer Toolkit
Recently Microsoft also released an updated version of their CRM developer toolkit – Microsoft Dynamics 365 Developer Toolkit which is a set of Microsoft Visual Studio integration tools, focused on accelerating the development process. I recommend that you read Microsoft Dynamics 365 Developer Toolkit Series – Part 3  to get a feeling how you can use the Dynamics 365 Developer Toolkit.

Option 3: Dynamics CRM & 365 Developer Extensions
There are however also other tools out there such as the Dynamics CRM & 365 Developer Extensions from Jason Lattimer which is a very worthy replacement of the SDK Developer Toolkit. It contains a lot of templates and will accelerate your development of plugins and workflows by allowing for a one-click deploy directly from within Visual Studio but also contains building blocks for using unit test for your plug-ins. It currently supports Visual Studio 2012, 2013 and 2015.

Before you can use the CRM Developer Extensions you will need to change some settings in Visual Studio 2015 – go to Tools>Options and navigate to CRM Developer Extensions (See screenshot below)

Option 4: Microsoft Dynamics CRM/365 Plugin base class
Jonas Rapp also has a very light-weight and simple to use plugin-base class available which also includes tracing and timing information – check out


Thursday, April 06, 2017

Weekly reading list 06/04/2017


Tuesday, March 07, 2017

CRM User Group Belux Chapter meeting - Data analytics and Business Intelligence

On March 23th, the Belux chapter of the Dynamics CRM user group organizes the first user group meeting – check out the agenda below and register for the Q1 2017 CRMUG Belux Chapter meeting on the CRMUG Belux site


  • 13:30 USER SUCCESS STORY - MARKETPLACE PORTAL AT I.P.M. GROUP (By Karim Ben Salah, Project Manager @I.P.M. )Group) As always, the Chapter Meeting starts with a user success story. This time I.P.M Group takes the stage to show us how they have combined MS Dynamics CRM and Open source NopCommerce to provide a powerful and flexible on-line e-commerce platform. The platform manages I.P.M.'s store, marketing product and offer catalog, huge amounts of real time transactions and complementary integrations with direct marketing tools. I.P.M Group has improved the user experience with a smart cross brand Single Sign-On, one-click payment checkout and a fully responsive web interface.
  • 14:30 HOW DATA ANALYTICS WILL BE PART OF YOUR COMPANY BOARD IN 2020 (By Julien Weber, Business Evangelist @ Wizata) Discover with real life cases how Advanced Data Analytics integrated to the Microsoft Environment is helping companies today to drive value, optimize processes or improve the decision making process. Get inspired on how Cortana Intelligence suite connected to Microsoft Dynamics 365 can help businesses to predict what�s next and stay one step ahead of competition.
  • 15:30 DYNAMICS 365 AND POWER BI (By Joris Poelmans, CRM Consultant @Realdolmen) This session will show you how Power BI can be put to practical use in combination with Dynamics 365. It is targeted at both business and technical users who want to take reporting and analytics to the next level. In this demo-heavy session you will learn to use the Power BI Designer to query CRM data, surface the data in dashboards and graphs and integrate it into your Dynamics 365 environment.
  • 16:30 ROUNDTABLE AND DRINK What's keeping you awake at night? Do you have a question to ask or a story to share with other Dynamics 365/CRM users? This is the perfect place and time.


  • Doors open on : 23 March 2017 – 13:00
  • Location: AG Insurance - Room New York A Rue du Pont-Neuf / Nieuwbrug 17, 1000 Brussels

Gotchas when using curl on Windows

Curl is a command line tool for transferring data with URL syntax supporting multiple protocols such as HTTP, HTTPS, FTP,etc… It also supports SSL certificates and HTTP commands such as HTTP POST, PUT, GET, etc … It is by default installed on MacOS X but if you have Windows you will need to download it first – I’m using the Curl Win64 – Generic version 7.53.0 build by Viktor Szakats. 

Tip 1: You can use curl to test out REST APIs – unfortunately when I typed curl –XPUT ‘http://localhost/api/scorelead’ – I immediately got an error curl: (1) Protocol 'http not supported or disabled in libcurl.’ A very misleading error message because the way to resolve it on Windows is to just replace the single quotes with double quotes so use curl –XPUT “http://localhost/api/scorelead”

Tip 2: Check out Using Curl for ad hoc testing of RESTful Microservices for some other examples – another gotcha is that when you want to post a JSON payload you will need to escape quotes using this format -  curl -H "content-type:application/json" –XPOST “http:/localhost/api/authenticate” –d "{\"username\":\"\",\"password\":\"test123\"}"

Technorati Tags: ,,,

Monday, March 06, 2017

Dynamics 365 weekly reading list 06/03/2017


Wednesday, February 22, 2017

Organization Insights solution released for Dynamics 365

Organization Insights for Dynamics 365 is a new solution that provides insights into the usage, activity and quality of service for your Dynamics 365 (online) instance. It has been available in preview since a couple of months and is currently compatible with December 2016 Update for Microsoft Dynamics 365 (online) 8.2 – to use the Organization Insights solution, download it from AppSource and install it in the instance you want to monitor using this download link  Although the documentation still marks it as preview -  Preview feature: Use the Organization Insights dashboard to view metrics about your instance – the Office 365 message center states that it has been released  on the 8th of February.

Getting started with Microsoft Flow and Dynamics 365

Microsoft Flow is a cloud-based service that  helps non-developers work smarter by allowing them to automate workflows across applications and services such as Office 365, Dynamics 365 but also Salesforce, Slack,etc... It is comparable with other tools such as Zapier and IFTT. Flow is part of Microsoft’s Business Application Framework which also includes PowerApps and which can be characterized as a low code application platform (See New development platforms emerge for customer-facing applications - Forrester research and low-code development platforms: the answer to soaring business application needs on this interesting trend). Microsoft Flow is positioned within the Business Application Framework as a next-generation integration layer for the different Microsoft clouds (Azure, Office 365 and Dynamics 365)

Microsoft Flow provides building blocks for integrating with external services and systems both from Microsoft such as SharePoint, OneDrive for Business, SQL Server, Azure components (Blob storage, Queues) but also from external vendors such as Salesforce, GoToMeeting, Instagram, etc … – there are currently 90+ different services available and new services are added on a weekly basis. Some of these services are only available in a premium plan such as Salesforce, Common Data Service, Citrix Gotowebinar and Citrix Gotomeeting, etc … whereas other services are also available in the free version of Flow.

Microsoft Flow provides a visual design surface within a browser (but mobile clients are also available for iOS and Android) where power users can add multiple actions which interact with services/applications, triggers (events that start a flow), conditions (allow for branching), loops, and more … I strongly recommend you to browse through the documentation Get started with Microsoft Flow or use the Microsoft Flow – Guided learning to get started.

You can either build a flow from scratch or you can start from one of the templates –  each template flow is designed for a specific purpose and is ready to be used,  you just have to configure the template. It is however also possible to add additional processing logic within flows created based on these templates.  Microsoft Flow allows you to configure a number of interesting scenarios – you should definitely check out Dive into Microsoft Flow, create automated workflows between your favorite apps and services (Ignite 2016 recording) which shows you examples such as:
  • Auto archive e-mail attachments to a SharePoint document library
  • Sent follow up reminders when new leads are created in Dynamics 365
  • Send mobile notification when a service goes down
  • Collect social media mentions (e.g. twitter) of your company or its products
From a Dynamics 365 perspective there are currently 5 triggers and 16 actions available which allow to build quite advanced scenarios such as outlined in  Create smarter flows using Microsoft Cognitive Services LUIS but Flow can also help you with things which might seem simple or straightforward from a business perspective but which would require you to write code such as No code approach Delete attachments from corresponding SharePoint folder when a record is deleted in CRM using Microsoft Flows or Quick surveys using Microsoft Flow (the only limit is your imagination … )

An important thing to understand is that Microsoft flows always run with the connection details that you provided when configuring the flow. So flows will always have the same permissions as the credentials that you use to create e.g. when you create a connection to Dynamics 365 for Sales and use your own login and password, it is your credentials which are used to execute the actions against CRM Online. A flow can never have escalated permissions.

Microsoft Flow is powered by Azure Logic Apps – every flow is actually a Azure Logic App which runs in a subscription which is managed and maintained by Microsoft. So you can basically use the same APIs, functions and designer in Microsoft Flow as in Azure Logic Apps. Microsoft Flow however provides a more-business oriented user experience.  An interesting scenario is where you call Azure Logic Apps from Microsoft Flow or vice versa using HTTP cards, but also one Flow call another Flow as well as one Azure Logic App calling into another Azure logic App. I will look at some examples of  Azure Logic Apps in future blog posts. Both Flow and Azure Logic Apps often allow you to solve the same problem but they are targeted at a different audience and sometimes subtle differences will determine your choice as outlined in Considerations on using Microsoft Flow or Logic Apps to sync documents

Microsoft Flow is available in a number of different plans going from a free version with 750 runs per month up to a Flow Plan 2 with 15.000 runs. The paying version also allows access to a number of premium connectors such as Salesforce, Common Data Service, Citrix Gotowebinar and Citrix Gotomeeting, etc … For up to date pricing as well as the difference between the different versions check out

To conclude, some points of attention, Microsoft Flow is fairly new and the product still has its occasional hiccups – both within the design surface as well as in execution of flows. Another thing to remember is that while the number of Flow executions might seem quite large I would recommend to define specific governance around the usage of it since currently no flow usage across your company is not available (but on the roadmap)


Thursday, February 02, 2017

Dynamics 365 weekly reading list 02/02/2017

Apparently the weekly Dynamics 365 weekly reading list is slowly evolving into a monthly one but still enjoy:

Thursday, January 19, 2017

Power BI and Microsoft Dynamics 365 one year later

It has been a year since I last wrote a blog post about Combining Microsoft Dynamics Online and Power BI – so it is time for a little update since a lot of great new features have been released in the last couple of months which are also interesting for Dynamics CRM.
The CRM Online 2016 spring release introduced the release of specific content packs for Dynamics CRM Online  – the Dynamics CRM Online Sales Manager and Service Manager content packs include a number of predefined key metrics and key charts and can be used as inspiration to build your own reports. Recently Microsoft also made the PBIX file (Power BI Designer files) available for download so that you can now also include your own custom entities and adapt these content packs to your specific needs – see Use Power BI with Microsoft Dynamics 365 for the links.
Another interesting update was the release of support for R in June 2016 – see R for the masses with Power BI.  To get started with R in Power BI – you can download the Power BI sample with correlation plot in R which uses the rrplot package. Power BI Desktop does not include, deploy or install the R engine. I installed RStudio, the sample Power BI project uses the corrplot package, so you will first need to install this package using the R console prompt in RStudio.

Definitely check out the Create Power BI visuals using R guide (Don’t forget to take at the current limitations in R at the end of the post) and Getting started with R Visuals in Power BI to get started – afterwards you definitely need to take a look at the Welcome to the R script showcase Power BI Gallery to see some interesting examples that you can use.

Listed below is an example of how you can use decision trees in Power BI with R to visualize the probability of something you want to estimate, based on historical data – the sample project uses data about the survival statistics of passengers of the Titanic. The decision tree classifier automatically finds the important decision criteria (or features) to consider which can help you can in making decisions. Decision trees are a form of multiple variable (or multiple effect) analyses. An example of a multiple variable analysis is a probability of sale or likelihood to respond to a marketing campaign as a result of the combined effects of multiple input variables, factors or dimensions.

In July 2016, Power BI Embedded also reached general availability – Power BI embedded allows ISVs to provide the richness of Power BI to customers within their specific multi-tenant applications. This can for example be an Azure hosted web application in which an ISV wants to embed fully, interactive reports built using Power BI. For more information check out Your data. Your visualizations. Your way – with Power BI – which explains the difference between Power BI Embedded and standard Power BI – as well as What is Microsoft Power BI Embedded? Power BI also allows you to embed Power BI tiles in Dynamics 365 dashboards – see Display Power BI visualizations in Dynamics 365 dashboards or  Add or Edit Power BI visualizations on your dashboard for some walkthroughs.

Another important change is the endpoint that you need to use when connecting Power BI directly to Dynamics CRM 365 – from Dynamics CRM version 8.1 onwards (so also for Dynamics 365) you should use the OData endpoint URL and not the OrganizationService SOAP service even though the dialog still shows it as an example – the documentation Use Power BI with Microsoft Dynamics 365 (Technet) has already been updated for this change.

To get an overview of what has been released and what is under development around Power BI for Dynamics 365  - you can also take a look at the roadmap for the updates which have been recently released or which are under development -


Wednesday, January 11, 2017

Organization Insights for Dynamics 365

This new Organization Insights solution provides you with a number of interesting insights and metrics about your CRM instance (aka organization) such as entities which are being used, the storage used by different tables, user activity, system job activity, plugin statistics and API call statistics.  It currently is available as a preview feature in the December 2016 update can be installed separately from the AppSource . This solution provides more detailed information than the Organization Insights dashboard which is included by default in a Dynamics 365 December 2016 Update instance.

One of the new interesting dashboards which is part of this soltuion is the storage dashboard which provides information about the storage used by your tenant and the different CRM instances (or organizations). This dashboard displays total storage and storage per tenant, a breakdown of the top 10 largest tables by size and row count in the current instance and information about common tables  - tables which contain records which can be linked to different types of records such as attachments, audit logs (auditbase) and asyncoperationbase (this table tracks your asynchronous processing job execution (system jobs, workflows, plug-ins, etc). 

A Dynamics 365 Plan 1 application subscription includes by default 10 GB database storage and additional storage is added at a rate of 5GB for every 20 full users – storage is accrued but there is a technical limit of 5TB (For more details see the Dynamics 365 Licensing Guide). It also is possible to purchase additional storage at a price per GB/month.  For those of you who are still using Dynamics CRM Online licenses, will have 5 GB standard storage and 2.5 GB extra per 20 professional users (capped at 50 GB - for more details see the Dynamics CRM Online Licensing Guide)

So it is important to analyze and clear space in Dynamics 365 as outlined in this post – which also suggests a free Dynamics CRM Online  & Dynamics 365 storage space analyzer solution that you can install.


Sunday, January 08, 2017

Using Azure Service Bus and Dynamics 365

You can connect CRM Online (Dynamics 365) with Azure Service Bus by coupling the CRM event execution pipeline to the Microsoft Azure Service Bus. This connection lets the data that has been processed as part of the current CRM operation to be posted to the bus. From here, other line of business applications can consume these messages from Service Bus instead of directly talking with CRM. This is a commonly used hybrid integration scenario.

As of CRM Online Update 1 (Spring release – see KB 2925359 Microsoft Dynamics CRM Online releases for an overview of the different release) – the recommended way of integrating Dynamics CRM Online and Azure Service Bus is using Shared Access Signature authentication.This blog post still uses ACS(Access Control Service) authentication – in a next post I will outline the differences when using SAS (Shared Access Signature) authentication.

Dynamics CRM Online is by default pre-configured for Microsoft Azure integration. You will however still need to proceed with the following steps:
  1. Make sure that you have the Microsoft Azure PowerShell module installed – if you have multiple subscriptions linked to your login – check out  Quick tip – using Azure PowerShell with multiple subscriptions
  2. Create a Service Bus Namespace as outlined in Walkthrough: Configure Microsoft Azure ACS for integration with Dynamics CRM ( )
  3. Add extra configuration settings on Azure Service Bus :
    1. Create a service identity (issuer)
    2. Create a rule group and rules
    3. Configure the scope
  4. These settings can be configured in two different ways
    1. Follow the steps outlined in
    2. Use the plugin registration tool to add the extra required configuration using the (Save & Configure ACS) screen when you register a new endpoint. I will use this option since this is the simplest from a developer perspective – before you can use this screen make sure that you perform the next two steps. First you will need to download the certificate from Dynamics CRM Online – it can be found underneath Settings>Customizations>Developer resources screen
      Next you will need to open Azure Portal (I will be using the classic portal since Azure Service Bus management is still in preview on the new portal) and select the connection information from the Azure Service Bus namespace that you created in the first step. Copy the default key. 
You have now completed all the preparation, so now you can proceed with the configuration within CRM. You will need to create a service endpoint configuration in CRM to allow it to talk to Azure Service Bus. A endpoint is a commonly used term in enterprise integration patterns – (See Introduction to messaging endpoints -  for more details). Endpoints in CRM are used to connect CRM to a messaging system so that it can send and receive messages. As already mentioned, CRM provides standard functionality to integrate with Azure Service Bus as a messaging system.

In this example we are going to integrate CRM with a persistent queue and we are going to leverage the built-in Azure plugin in Dynamics CRM. Open the plugin registration tool and select Register New Service EndPoint.

You should see the screen below for registering a new service endpoint – if you get another screen you are most likely using a newer version of the CRM SDK – and you switch to the CRM 2015 SDK or the first build of the CRM 2016 SDK (December 2015 release). 

Before Dynamics CRM Online can post on the queue you will need to create the queue which was specified in the path “jopx/demo”. You can write code for this or you can simply use a tool such Service Bus Explorer - to create the queue (or you can create the queue from within the Azure Management Portal)
Click on Save & Configure ACS to add the necessary configuration data as outlined before. Here you will need to enter the following information:
  • Fill in the management key that you copied over from the Azure Service Bus connection information
  • Select the certificate file that you downloaded from your CRM Online instance
  • Fill in the issuer name – (This information is also copied over from the Developer resources screen in Dynamics CRM)
When you click Configure ACS – information will be logged on the same screen make sure that you don’t get any errors.

Finally, you will need to define for which CRM entity you want to couple the event execution pipeline to the Microsoft Azure Service Bus. The native CRM Azure-aware plugin allows you to post the data that is being processed as part of the current CRM operation to the queue. It does this by transferring the information in the form of a serializable RemoteExecutionContext object. Registering the Azure-aware plugin is the same as registering any plugin for CRM. Use the plug-in registration tool and right-click on the service endpoint that you just created, then select Register New step to select the “Create” message and the “Contact” entity.

To test it out you simply create a new contact record and you should see that a new entry appears in the CRM System Jobs. After creating a new contact you should have an entry in the CRM System Jobs:  Settings > System Jobs,  indicating that the asynchronous plugin posting the create to Azure has been executed. You can also see the message posted on the queue in the Azure Portal.