Search

Antony Ellis Dynamics 365 CRM

The blog where Microsoft Dynamics 365 knowledge is shared and development made easier

Category

CRM Environments

CRM 2016 -Problems after renaming the CRM Server

Big, big, major caveat here this article talks about stuff that is unsupported by Microsoft regarding the Dynamics platform just so we are clear from outset. Recently I stumbled across an old article from The Hosk concerning how changing the server name in 2011 broke the deployment.

It got me thinking whether the same would be true for CRM Dynamics 2016 so I had a play with one of my local virtual machines and committed the Sin of changing the server name. Actually, committed many sins one of them was not taking a backup of my VM first and thereby rendering it useless at this point in time.

Anyways, as I should have expected this completely buggered up the Dynamics CRM application. Now before I get into what I did to fix it, it’s worth pointing out that the safest approach is to uninstall Dynamics CRM and then re-install after you have changed the server name. In addition would not recommend the approach I took either especially on a commercial server. So following the server name change the following were broken:

  • CRM Deployment manager
  • CRM application
  • SQL Server (Configuration)
  • MSCRM_CONFIG database
  • SSRS
  • Registry Settings!

Ouch.

Concerning Active directory

  • PrivUserGroup
  • SQLAccessGroup
  • ReportingGroup
  • PrivReportingGroup

 

In my case didn’t need to change anything here or mess about with domain GUID’s/entries because the organisation was still on the same domain and active directory therefore had the same GUID’s as before and new that the server was the same server so it just updated the member list automatically using the new server name. This may not be the same behaviour for older versions of Active Directory.

Fixing Deployment Manager (Connection Error)

This was completely buggered to point where it could not connect to CRM. The deployment manager is mostly dependent upon the registry for its settings at least when it comes to making the connection and of course MSCRM_CONFIG database. When trying to run the deployment manager it came back with an error stating the MSCRM_CONFIG database was not available and/or removed.

  1. Rename the server and don’t tick restart at this point
  2. Close all browser windows/crm tools
  3. Go to registry and update
    1. HKEY_LOCAL_MACHINE/SOFTWARE/MICROSOFT/MSCRM
    2. Change the old server name to new server name in keys (configDB key, serverURL)

Update the MS_CONFIG DB tables and change any reference to old server name with the new server name you will need to check each of the fields to be safe in these tables:

  • Server
  • Organization
  • SystemUserOrganizations

At this point if you were to restart the server you would find the CRM application will be working again however other things will still be broken for example the end point URL’s displayed in the organisation still have old server names and the deployment manager is broken when you try to create a new organisation.

Fixed Yet?

Nope. To finish off we need to update SQL Server, Deployment manager settings and the Reporting Services configuration manager.

Fixing SQL Server

This was needed for both the create New Organisation and the CRM Diagnostic check (Run within the new organisation and repair, remove CRM setup application) to work, otherwise you will get errors saying that the Instance name must not be the same.

Firstly … check what the server name is at the moment concerning SQL Server

SELECT @@Servername

This returned old Server Name In SQL Server

Even though we have updated the CRM settings, the SQL Server instance still has references to the old server name. In order to resolve this we need to go into SQL Server and run the following T-SQL:

use master

go

SELECT @@Servername

exec Sp_dropserver ‘Value returned by @@ServerName’

exec Sp_addserver ‘The current server name’,local

Restart the SQL Server instance after executing the above T-SQL.

Fixing the SSRS Configuration

If the SQL Server Name is still showing the old server name you need to click on Change Database and redeploy the reporting database either to a new database or overwrite the existing one.

picture1

Fixing Deployment Manager (New Organisation and Web Service End Points)

To fix the browse link going to wrong (old server) and to ensure end-points displayed in CRM organisation application is correct you need to the update the following which you get to by right-clicking on the top node in deployment manager (Microsoft Dynamics CRM Server) then editing the properties:

picture2

After which the Deployment Manager new organisation functionality should work. It is worth noting the above was also needed to fix the CRM diagnostic checks which are done by both deployment manager or when you try to change the CRM installation via add/remove programs.

Finally: Restart the Server.

Did it work?

For me it appears to be working ok.

Should you do it?

Nah absolutely not! It is best to do a clean re-install. The moment I encounter a strange issue within this dev environment you can bet money on it that I will do a clean install of CRM 2016 because it will always be in the back of my mind “could this be related to that time I changed the server name!” however for academic purposes thought would share the experience.

Advertisements

How to setup a Dynamics CRM Development Environment

Start Your Engines

By the end of this article you will have a working development environment with all the core tools required to extended the functionality of Dynamics CRM.

Before we get started it is important to highlight some of the fundamental approaches to CRM Development. Microsoft Dynamics CRM is full of features and capabilities that should be utilized in the first instance, simply put, we don’t go and try to re-invent the wheel when we can leverage stuff already out of the box (OOB). There are a  host of reasons for why we take that approach and something to talk about in a separate article.

An example: Once I was working for a client and they had customised the application ribbon (command bar) to provide “Quick Call” functionality. This involved not only modifying the ribbon XML but also creation of custom Icons, along with JavaScript events and code so that a Phone Activity could be created (how many hours/maybe days wasted??). Wow. The developers at the time clearly were not familiar with Dynamics CRM Quick Create feature it was there all along within the system.

untitled

This is not uncommon, the truth is there are so many features within Dynamics CRM and typically (at least) two significant updates every year to the product that it is easy, even for experienced CRM developers to accidentally create some level of customisation that already exists within the platform. Not only does Dynamics CRM have one of the steepest learning curves but is constantly being improved, therefore keeping yourself up to date with each release should be high on your priority list.

Ok, generally when we talk about customising Microsoft Dynamics CRM it falls within two main categories:

  • Customisation and Configuration (aka. Out of the box)
  • Extending CRM (Development of Plugins, Custom Activity Workflows, Client and server side API’s, System Integrations)

This article is concerned with the latter and for that you will need to not only build a development environment but also download and configure a number of different tools.

 

Anatomy of a CRM Development Machine

So what would a typical development machine contain?

  • Windows 10 Pro
  • Visual Studio 2015 (or earlier)
  • CRM Developer Toolkit (How to get CRM Developer Toolkit working with Visual Studio 2013 this also covers 2012 and 2015 versions of  Visual studio)
  • XRM Toolbox
  • .NET Frameworks
  • Internet Explorer 11
  • Google Chrome (often quicker and easier than IE! – what the hell?)
  • Notepad ++
  • 7-Zip

Depending on requirements you may even take it a step further and have CRM Dynamics 2016 running locally on your machine (On Premise) along with SQL Server 2014. That may seem like a crazy idea for a “thin client” but thanks to Virtualization technology we are able to do this and actually most of my development environments are virtualised running on a laptop without any kind of performance issue. In a commercial environment where we have multiple developers, the dev tools are on a shared virtual machine server. I will write a separate article on how to setup Virtualised development environments along with the pro’s and con’s of such an approach at some point.

Getting Things Setup

If only it was simple, it really isn’t, especially when you are new to extending CRM, get ready for lots of frustrated hours.However this guide should if followed precisely help to reduce your cortisol levels. The order in which you install software is important to avoid compatibility issues so below is how you should set things up:

  • Install Microsoft Visual Studio (if running multiple start with the older ones first)
  • Enable Windows Identity Foundation (WIF)
  • Download .NET 4.5.2 developer pack (needed for CRM 2016)
  • Download Microsoft Dynamics CRM 2016 SDK
  • CRM Developer Toolkit
  • XRM Toolbox

Install Visual Studio

The nice people at Microsoft allow us to use Visual Studio 2015 Community edition for free so long as it’s for learning and non commercial purposes which is great grab yours (Download Visual Studio Community Free Version) or if using this at work grab yourself the Professional edition from your corporate MSDN subscription. The installation is really straightforward you can pretty much use all the default settings so there isn’t much more to say on this area.

Enable Windows Identity Foundation

This is usually located within Programs and Features (Depends what Operating System you are running) and is needed primarily for the CRM Developer Toolkit to place nicely along with XRMToolbox plus other 3rd party tools.

untitled

If WIF not listed here you will probably need to use Powershell to install the feature (Add-WindowsFeature windows-identity-foundation), or if running a really old operating system will need to download the installation from Microsoft.

Get .NET Developer Pack

So I like easy, the easiest way to grab it is to fire off Visual Studio, go to new->Projects then select the option as shown here:

untitled

This will open up your browser and the one you need to download is shown here:

untitled

 

Microsoft Dynamics CRM 2016 SDK

It could be that you are targeting and older version of Microsoft Dynamics CRM perhaps 2015, 2013, 2011 or God forbid 4.0!  That’s ok, it’s important in my view to always be forward looking so being setup for the current version is always a good thing. The .NET libraries are cumulative so if you find that you need to use an older version of the framework simply Target the appropriate version that CRM was built upon from within the project Target Framework pick-list (or combo control if being technical). Grab the latest CRM 2016 SDK or if targeting an older version of CRM get the latest SDK for that version.

CRM Developer Toolkit

You might be thinking why? Well let me explain. If you have not used this before you are really missing out this includes those developers who have be extending CRM since God was a lad.

untitled

The CRM developer toolkit enables you to:

  • Browse the CRM Solution/Entities without having to leave Visual Studio
  • Deploy Plugins,  Custom Workflow Activities, Web Resources (Custom Images, HTML Pages, Javascript) from a single click to your target CRM solution
  • Maintain all CRM code in one central place for development work
  • Maintain references to all Assemblies (custom and 3rd party)
  • Provide Early Binding across all your project types from one visual studio solution
  • Enhances rapid development and productivity in developer teams (IMHO)

Then providing you are checking in code to a shared repository (TFS, Subversion etc), it makes work much easier when you have multiple developers all working on a CRM implementation. This unfortunately is a bugger to install with any version of Visual Studio after the 2012 edition .. but lucky for you I have wrote a guide on How to install the CRM developer toolkit with Visual Studio 2015.

XRM Toolbox and Other CRM Tools

As I mentioned at the start of the article the story does not end with Visual Studio. There are a number of tools you will need to have in your utility belt including:

  • XRM Toolbox (Tools the most commonly used purpose is for Sitemap/Iconator/MetaData)
  • SvcUtilFilter (A free visual studio solution that creates early binding classes automatically)
  • Ribbon Workbench (CRM solution file that makes it easier to customise the application ribbon simply install within your dev CRM enviornment)

XrmToolBox is an application that can connect to Microsoft Dynamics CRM 2011, 2013, 2015 and 2016 (Online, OnPremise of IFD). It is shipped with more than 20 plugins to handle several administration, customisation or configuration tasks. One of the great points about XrmToolBox is its capability to welcome external plugins written by other developers, just by implementing specific part of XrmToolBox code. https://github.com/MscrmTools/XrmToolBox

Requires: .NET 4.5.2 and WIF

http://www.xrmtoolbox.com/download.html

Grab yourself the 2016 version

Download

Credits

Featured Image: shehan365 via photopin.com, creative license.

 

Powered by WordPress.com.

Up ↑