Download makecert.exe and pvk2pfx.exe for creating self signed certificate

Please download the files from below link

https://1drv.ms/u/s!Ap6jgr5X4uAmgdVHpVTSwwQrXzYUXQ?e=v9ovAh

Hope this helps!

Debajit Dutta

(Dynamics MVP)

Advertisements

Issues with self signed certificates for server-server integration between CRM and Sharepoint? Here is what you may need to know to save your day.

As promised in my last blog, I am back with one more scenario where consultants get stuck in on-premise environments. Server-server SharePoint integration with Dynamics is something we take for granted when we set up trial instances for demo in online environments. After all, entire internal plumbing is handled by Microsoft and we just need to do follow some sequential steps to accomplish the same.

However things are not so rosy for on-premise systems. You have to follow a host of steps as detailed out in this article – https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/administering-dynamics-365/dn949332(v=crm.8)

One of the requirements for server based integration is Sharepoint should be SSL enabled. And many a times, you need to set this up with self signed certificates to create a working POC before customer approves it. This post specifically deals with all the problems that you might face while setting up server based integration using self signed certificates. The post will highlight some of key errors usually encountered and how to resolve the same.

Before you proceed with the below error scenarios, just make sure you followed the below prerequisite steps – https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/administering-dynamics-365/dn949332(v=crm.8)#other-prerequisites-and-limitations

Error 1: CertificateData for CertificateType: S2STokenIssuer not found

This error is usually thrown in the after providing the Sharepoint site name and SharePoint Realm ID in the “Enable server based SharePoint integration” configuration screen.

This usually happens if you miss the step to add the server-server certificate to Microsoft Dynamics 365 configuration database as explained here – https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/administering-dynamics-365/dn949332(v=crm.8)#add-the-server-to-server-certificate-to-the-local-certificate-store-and-microsoft-dynamics-365-configuration-database

You would need to open PowerShell in administrative mode in CRM server and then navigate to <drive>:\Program Files\Microsoft Dynamics CRM\Tools folder. Then run the below command.

.\CertificateReconfiguration.ps1 –certificateFile <certificate pfx file location> -password <private certifacte password> -updateCrm -certificateType S2STokenIssuer 

-serviceAccount <service account for CRM Async service> -storeFindType FindBySubjectDistinguishedName

 

Error 2: Certificate private key is not found

This error is thrown when we run “CertificateReconfiguration.ps1” power shell script as described above. But why this error?

To be honest, I am not a certificate expert and I am not sure why this happens. But after multiple trial and error I was able to workaround the problem. And I am going to share that.

There are multiple ways to create a certificate. So what options we have. I am going to discuss the commonly used one and what error you may get for each.

Option 1 – Using IIS

If you search in Google on how to create a self signed certificate, the first article that may catch your attention is to create a self signed certificate from IIS.

image

You create the certificate but you will find the certificate does not have a private key with it. And hence it won’t work while you run the above powershell command.

Option 2 – Using PowerShell command

The next one that is suggested for Windows 10 and above is using Powershell command – “New-SelfSignedCertificate” . The below command would create a certificate and store in Personal store.

New-SelfSignedCertificate –DnsName <You CN name for certificate> -CertStoreLocation “cert:\LocalMachine\My”

This one created has a private key associated with it but if you try to run the powershell script  – “CertificateReconfiguration.ps1” you get the error – “Certificate private key is not found”. This is surprising because the certificate has a private key associated with it.

Option 3 – Using MakeCert.exe

After much googling around, one of the community blogs suggested to use MakeCert.exe to create the self signed certificate and it might work. So tried the below commands.

makecert -r -pe -n "CN=HOSTNAME" -eku 1.3.6.1.5.5.7.3.1 -sky exchange -sv HOSTNAME.pvk HOSTNAME.cer

The above command will create a certificate file and a private key file. Make sure to replace hostname with value for your environment. But we need a .pfx file to run our PowerShell command. To create a .pfx file out of this, please run the below command.

pvk2pfx -pvk HOSTNAME.pvk -spc HOSTNAME.cer -pfx HOSTNAME.pfx

Once the .pfx file is generated, you can import the file in personal store and use this for your SharePoint SSL binding. Once done execute the PowerShell command – “CertificateReconfiguration.ps1”  and it should work just fine.

As you can see from the above, you need couple of .exe files to make this work – makercert.exe and pvk2pfx.exe. But where do I get them?

Unlike what I thought, it was quite a hassle to get it. MakeCert.exe shipped with Visual studio till version 2013 and later it was stopped. You can get makecert.exe by installing Windows 8 SDK. But if you are using windows 10 and above, that is an issue as well. Windows 10 SDK is quite a big installation and doing that just to get a standalone makercert file is something which baffled me. After much pain, I was able to get makecert.exe from Fiddler2 installation and pvk2pfx.exe from Windows SDK. To help readers, I have put those files in the one-drive link shared through this blog.

https://debajmecrm.com/2019/08/23/download-makecert-exe-and-pvk2pfx-exe-for-creating-self-signed-certificate/

You can just use these and everything should work fine.

Hope this helps!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

Multiselect picklist for Dynamics 365 (http://www.xrmforyou.com/multi-select-picklist.html)

 

Upload multiple attachments in CRM Notes/ annotations with metadata for each attachment- Introducing Notes Manager from XrmForYou.com

It gives me great pleasure to announce the new CRM add-on from XrmForYou stable – Notes Metadata Manager utility from XrmForYou stable.

Well Notes (Annotations) have existed in CRM since pre-historic times. And perhaps one of the most widely used feature in Dynamics till date since its inception. After all it gives a nice way to store your documents along with some notes and description which can be read by CRM users.

However with my many years in consulting, I realized the pain points of customers using Notes as well.

  • Can I upload multiple attachments at one go with Title and description?
  • Can I add new fields in my notes entity (Annotation) to capture some extra information along with Note Title and Note Description?
  • Can I put notes are separate from my timeline control? May be in a separate tab?
  • Can I drag and drop multiple documents in Notes section so that it will automatically upload?
  • Can I create more than one Note record at a time with attachments?

We have progressed leaps and bounds but even with the latest version the answer to most of the questions above is “NO”. Also traditionally since inception, Notes entity was not customizable to add new fields and users were just limited to using only two field “Note Title” and “Note Description”.

For trial and pricing, write to us at info@xrmforyou.com

Well, we have understood the pain and hence we have released this Add-On for you. Works perfectly on UCI in web browser and on tablets and phone as well.

Step 1: Configuration

It comes as a Managed solution. Once you install the managed solution and open up the solution configuration page, you get a screen like one below.

image

The top section is the license information which will be provided by our team.

The section below that shows all the entities which have been enabled for Notes. This is the area where you can configure additional metadata for your Notes records corresponding to each entity.

I click on Account entity and the existing metadata account shows up as shown below.

image

You can create up to a maximum of 10 additional metadata records as per the current release of the tool. The metadata currently supported are of type text and optionset.

image

Above is the way to create a text metadata. Also you can make the additional metadata mandatory to be entered during record creation by setting the Required? field to checked.

Below is the way to create an optionset metadata for your note record.

image

As you can see from above you can configure any global option set and map your Optionset Metadata with that global optionset for the list of possible values.

You save your metadata and that’s all from the Configuration Page.

Step 2: Setting it up on your form

The next step is setting up the custom notes control on the form.To do that you just need to include the custom web resource that comes with our solution on the form where you want to show the control. Detail on the web resource control follows in our actual documentation on our website. www.xrmforyou.com

Once the webresouce is inserted on the form, this is how it looks as shown below. Below are the screenshots in the Unified Interface environment.

image

Inline editing of Note title, Description and metadata.

image

Inline new record creation:

image

Inline search

image

Attachment Upload

image

Bulk Upload

image

Drag & Drop

image

For trial and pricing, write to us at info@xrmforyou.com

Hope this helps!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

Multiselect picklist for Dynamics 365 (http://www.xrmforyou.com/multi-select-picklist.html)

{Quick Fix} SSRS instance showing blank while installing reporting extensions for V9.0 on-premise

It’s been couple of months since I have written a blog. One of those years where health has gone south for me and I am gradually limping in back into my stride.

Ironically, as I am making my way back, I started with Dynamics V9.0 on-premise project for one customer as well and it’s been more than couple of years since I worked on an on-premise project. And it’s been a quite a learning so far. My next few blogs would be on my experiences with setting up Dynamics on-premise latest version starting with the easiest one.

So coming to the topic here. You may be thinking – why this post? To be honest, there a quite a few blogs which discuss on this. However each represents a specific solution. However this problem can arise for various reasons and fix suggested by one may not work for another. In this post I collate all the possible causes and their remediation. Feel free to write to me in case I miss something. I would love extra knowledge and add them to my post here.

Server : Windows Server 2016 datacenter

CRM : V9.0

SQL server: SQL Server 2017

This issue is not specific to V9.0 and users have faced this with earlier versions of CRM on-premise installations.

Check 1: Run reporting extensions set-up (SetupSrsDataConnector.exe) from box where reporting services is installed.

This is the easiest fix. Make sure you are running the set-up from the machines where reporting services is installed.

If you are running from reporting services box only but still the issue persist, lets go for Check 2.

Check 2: Service account in Report Server configuration manager must be part of PrivReportingGroup

To verify this, open Report Server configuration manager.

image

Navigate to “Service Account” on left navigation pane and verify your account. Here I am using a service account “xrmforyouadmin”. We need to verify if “xrmforyouadmin” belongs to PrivReportingGroup in Active Directory.

image

This step might require your domain admins help. Active directory is not something you will have access to as CRM consultant. However I am providing screenshots below to help you understand better so that you can guide your active directory admin in the right direction.

Open “Active directory users and computers” and then click on Domain controllers. You may find multiple PrivReportingGroups in there. To find the right one for your CRM Organization, you can follow the below link.

https://debajmecrm.com/2014/09/25/dynamics-crm-privusergroup-id-organization/

image

Open the “PrivReportingGroup” specific to your CRM organization and add the service account to the group.

image

Now go back and run SetupSrsDataConnector.exe. Check to see if the issue is fixed. Not fixed? Lets go for the next checklist.

Check 3: Make registry entries in SQL Server box.

The first thing to note here is all the below changes should be made in SQL server box. You would need administrative permissions on the machine to perform these operations. Please follow the below steps:

  • Open Registry Editor (regedit.exe)
  • Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS

image

  • Check for the Key MSSQLSERVER. If absent, create a new key as shown in the below screenshot. Key Name – MSSQLSERVER, Key value – SSRS

image

image

  • We  are done with this entry. We need to create one more entry. But for that we would need the SQL server version number installed. But how do I get it? Well, there are many ways. I am showing one of them. Open SQL server management studio and connect to database instance. Then type the below query.

image

As you can see from above screenshot, there is a version number in the result. Copy the same. In my case it is  – 14.0.2027.2

Now navigate to – “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SSRS\Setup”

image

Look for the entry with the name – “Version”. If not found create a new string value with name – “Version” and value as version of SQL server obtained from earlier step.

All set and done. Now restart SQL server and reporting services and try to install reporting extensions. The installation should successfully complete now

In case the issue is not fixed, the last option is to try install reporting extensions via configuraiton file by adding the instance name into the configuraiton.xml as detailed in below Microsoft Documentation link.

http://technet.microsoft.com/en-us/library/dd979397.aspx

Hope this helps

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

Multiselect picklist for Dynamics 365 (http://www.xrmforyou.com/multi-select-picklist.html)

Understanding “Record Count” and “NULL” condition check expression in “List Records” step of Common data service action in Microsoft flows

Be it “Citizen developers” or long time technical consultants in Dynamics, Microsoft Flows haven’t ceased to impress all. It’s liked by developers and customers alike and many a times have a deciding factor when choosing Dynamics 365 as the desired CRM platform over its competitors.

And if you have used Microsoft flows for Common data service, you must have used the “List records” step as well. And there are many cases where you need to perform an action based on whether the list returned any records or not. While this just seems too easy, surprisingly if you are not aware of the syntax, it may take some time for you to make it work.

The syntax for it is – length(body(‘<your list record action name>’)?[‘value’])

Well, the length function here is pretty obvious. However the trick here is to understand on how to get the array of items returned. If you inspect the results of list record step, you will find that the results are returned in an array called ‘value’.  You can check the length to be greater than zero or not and then take appropriate steps.

image

But wait. What is the “?” operator used for. And believe me, I keep on getting this question multiple times. To put in simple terms, it does check for not null condition and then evaluates the next step, just like you do in your code so that you don’t get “Object reference” error in your code.

Let’s take an example here. Say you want to get the GUID of the first record returned by “List Records” action. To test this in my flow, I create a very simple flow with “List records” step and post that I am initializing a variable with the GUID of the first record.

image

Observe carefully here. I have not used “?” operator here. Now this flow runs successfully when List records steps return data. However when there are no records returned in “List Record” step, then we get the below error.

image

I go ahead and update the expression now as shown in the below screenshot. Notice I have used the “?” operator here.

image

All set and done and when I run the flow this time, the flow runs successfully. As expected the value of the variable “X” is empty as there are no records returned.

image

Small stuff but end up saving some time.

Hope this helps!

Cheers!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

Multiselect picklist for Dynamics 365 (http://www.xrmforyou.com/multi-select-picklist.html)

Why is my calculated field not showing in rollup field definition?

And I had the same from my customer development team. The first thing I did was go to “Rollup Field” documentation in Microsoft Docs and sent to cross check the below points. After creating calculated fields over the years, I thought this has to be something related to configuration.

image

(Pic courtesy: Microsoft Docs)

Well, if you are wondering why your rollup field is not showing, most likely it is due to first of the two conditions mentioned.

Coming back to our scenario, client confirmed that they have not violated these scenarios. It was bit surprising as I had configured calculated fields in roll-up definition multiple times. So I had no other option but to open their calculated field definition.

And there I found it. What I realized is that beginners starting with roll-up field may make the same mistake too. Although their calculated field was not using other calculated field but they were using a field from parent entity in their calculated field definition.

If I take the second statement –A rollup can’t reference a calculated field that uses another calculated field, even if all the fields of the other calculated field are on the current entity”, one of the implicit perception from this would be – A rollup field can’t reference a calculated field that uses field of the parent entity in it’s definition”.

For experienced consultants, this may come in naturally. But what I realized from my experience is for beginners in Dynamics, they may tend to miss this point. The developer here just spent couple of hours trying to figure this out Smile

Hope this helps!

Cheers!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

Multiselect picklist for Dynamics 365 (http://www.xrmforyou.com/multi-select-picklist.html)

{Solved}Why are my CRM SDK Assembly references in Azure functions throwing error? How do I refer my custom assemblies which are not in Nuget?

And this was the complaint from one my customer. Why CRM assembly references in Azure function apps are throwing error? To add to my woes, that was some pretty important functionality running inside those small little functions and alas, the last few runs have failed. It was few months back and at that point of time, I fixed it.

But in a recent training on WebHooks, it seemed to me participants are not aware of this scenario and hence penning this blog for the benefit of my readers.

If you are absolutely new to Azure functions and how to add assembly references in Azure functions, I guess a bit of basic understanding before reading this blog would help.

If you would have developed Azure functions and referenced CRM SDK assemblies, you would done using project.json file. You would have created the file and then added the below JSON in the file to reference CRM SDK’s

{
"frameworks": {
"net461":{
"dependencies": {
"Microsoft.CrmSdk.CoreAssemblies": "9.0.0.7"
}
}
}
}

With azure functions 1.0, this would have worked just fine. At runtime, the framework would read your project.json file and restore the assemblies from Nuget. A detailed description on this by friend and fellow MVP Nishant Rana in this blog.

But the issue starts once Azure functions are upgraded to V2.0. And why? Because project.json is no longer supported in V2.0. Instead a new file – function.proj needs to created and referenced assemblies need to be defined in specific format.

All we need is to add a file with name “function.proj” and put the below contents.

image

<Project Sdk="Microsoft.NET.Sdk"> 
    < PropertyGroup> 
        < TargetFramework>net461</TargetFramework> 
    </PropertyGroup>    
    < ItemGroup> 
        < PackageReference Include="Microsoft.CrmSdk.CoreAssemblies" Version="9.0.0.7" /> 
    </ItemGroup> 
< /Project>

Your function code remains unchanged. But for beginners, you would need to reference with #r directive before using it.

image

Now once you run, you will see that the packages are now successfully restored and the application is working fine.

P.S – I tried at that time with .NET framework 4.6.2 and using <TargetFramework>net462</TargetFramework>. Unfortunately with this version it threw an error. May be I am missing something silly and I would be grateful if readers point this out.

Ok, so my CRM Sdk assemblies are in Nu-get and I can refer them just fine in the new function.proj file. But what about custom assemblies which are not in Nuget. How do I refer them? Well, if that’s the case, you should not be worried. There is an easy way to do this.

For this example, let’s assume Microsoft.Xrm.Sdk.dll is my custom assembly.

In your functions app, navigate to Platform Features –> Advanced Tools (Kudu)

Once inside Kudu, open Powershell prompt

image

Navigate to Site –> wwwroot. Once inside the wwwroot folder, create a new folder called bin

image

image

Go inside bin folder and drag and drop your assembly. In my case it is Microsoft.Xrm.Sdk.dll

image

All set and done. Now we just need to refer this assembly in our code file. As shown in the below screenshot, we can refer it by using a relative path.

image

Now you can start using your assembly. Simple isn’t it?

Honestly this part is not something related to specifically to D365 but with Microsoft’s vision of removing technology barriers, a CRM architect/ developer would  frequently find themselves working on Azure functions and this might be some information which saves some time.

Hope this helps!

Cheers!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

Multiselect picklist for Dynamics 365 (http://www.xrmforyou.com/multi-select-picklist.html)