Don't Let CRM Authentication Changes Tank Your Integration
It would seem that Microsoft is currently in the process of phasing out "basic style" authentication methods. They intended to phase out basic authentication in Business Central 2021 wave 1 but that got pushed back to 2022 wave 1. For CRM, though, the time is now. For those of you still running on older NAV systems, you are going to start seeing CRM integration break in the coming months due to elimination of Regional Discovery Services. There are different options to buy yourself some time but you should start coming to terms with the fact that OAuth authentication is is in your future.
There is a short term solution (until April 2022) for NAV versions 16 and above. For 17, there will be a hotfix to implement OAuth but for 16 you will most likely need to do a technical upgrade along with merging in the necessary OAuth code - and that's just a guess. For this post, I'm going to document the process for implementing the short term fix to update the XRM libraries. I'm starting with some older installs of 16 and 17 so I should be hitting all the speed bumps. So, here we go...
Step 1: Make sure you have .NET 4.6.2. I've always felt there should be an elegant way to do this but you have to check the registry:
This may ask you if it's ok to download multiple files and should result in a file named "microsoft.crmsdk.coretools.9.0.2.11.nupkg" in your downloads folder.
- The service folder.
- Any development environment that you want to compile from, which should be either on the NAV server or a development server.
- Any environment that you want to use the New-NAVCrmTable command from. You would only use this if you were extending CRM functionality to integrate new tables.
in my case, it was here:
C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\<version>\RoleTailored Clientor
C:\Program Files (x86)\Microsoft Dynamics NAV\<version>\RoleTailored Client
in my case, it was here:
The easiest way to do this is to open a command prompt with administrative privileges. Then you can edit the configuration files without any security issues.
- C:\Program Files\Microsoft Dynamics NAV\<version>\Service\Microsoft.Dynamics.Nav.Server.exe.config
- C:\Program Files (x86)\Microsoft Dynamics NAV\<version>\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe.config
- C:\Program Files (x86)\Microsoft Dynamics NAV\<version>\RoleTailored Client\Finsql.exe.config
As mentioned before, you always need to edit the server config, sometimes need to edit the finsql config and almost never need to modify the RTC config.
This is what you will need to add/change:
1 2 3 4 5 6 7 8 | <dependentAssembly> <assemblyIdentity name="Microsoft.Xrm.Sdk" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Xrm.Tooling.Connector" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> </dependentAssembly> |
This is what my server config file looked like (yours may be different):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | <?xml version="1.0"?> <configuration> <configSections> <section name="uri" type="System.Configuration.UriSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </configSections> <appSettings file="CustomSettings.config"/> <system.diagnostics> <assert assertuienabled="false"/> </system.diagnostics> <uri> <schemeSettings> <add name="http" genericUriParserOptions="DontUnescapePathDotsAndSlashes"/> <add name="https" genericUriParserOptions="DontUnescapePathDotsAndSlashes"/> </schemeSettings> <idn enabled="All"/> <iriParsing enabled="false"/> </uri> <system.net> <settings> <httpListener unescapeRequestUrl="false"/> </settings> </system.net> <runtime> <NetFx40_LegacySecurityPolicy enabled="true"/> <gcServer enabled="true"/> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="DocumentFormat.OpenXml" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="0.0.0.0-2.5.0.0" newVersion="2.5.5631.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Xrm.Sdk" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Xrm.Tooling.Connector" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> </dependentAssembly> </assemblyBinding> </runtime> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/> </startup> </configuration> |
...and my finsql.exe.config:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="DocumentFormat.OpenXml" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="0.0.0.0-2.5.0.0" newVersion="2.5.5631.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Dynamics.Framework.UI.Extensibility" publicKeyToken="31bf3856ad364e35" culture="neutral"/> <bindingRedirect oldVersion="1.3.0.0-8.0.0.0" newVersion="9.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Xrm.Sdk" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Xrm.Tooling.Connector" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> </dependentAssembly> <probing privatePath="Add-ins\CodeViewer;Add-ins\CodeViewer\CommonComponents;Add-ins\CodeViewer\EditorComponents"/> </assemblyBinding> </runtime> </configuration> |
Step 7: Restart your services. If you got everything in the right place, they will start. I messed up the XML on my first attempt and got an error about SxS (Side by Side) configuration being wrong. It was just a missing bracket.
Step 8: Modify the C/AL code to reference the new libraries. This won't be required in your production deployment (at least it better not be) because you will already have modified objects to import. For this step, you will need to open (or reopen, as the case may be) a development environment that has the new libraries installed and switch to a license with development capability.
Export codeunit and table 5330 to a text file:
At this point, my experience (working in NAV 2016 and 2017) starts to deviate from the instructions.
The instructions say to remove versioning information from the .NET variable declaration and indicates there will be a Microsoft.Xrm.Sdk reference and a Microsoft.Xrm.Tooling.Connector reference. I only found a reference to Microsoft.Xrm.Sdk, so I just changed that. I also changed the version number rather than deleting it entirely. The new version is 9.0.0.0.
2016 only had two references, 2017 had many, many more so you will definitely want to do a find and replace!
I then imported and compiled my changes and they worked!
If you have any strange error messages when compiling, starting services or testing DON'T PANIC! Just go back and make sure you've...
- Got the right files where they need to be (confirm by right-clicking the file, going to properties and selecting details.
- Make sure the files are unblocked.
- Make sure you've changed the library version in code. Select all objects with CRM in the name (*CRM*) and compile them.
- Make sure you've updated your config files.
- Check the Event Viewer. There will likely be more information there.
Comments
Post a Comment