Sunday, 5 January 2014

Enterprise Development Best Practice for Dynamics CRM

As part of our quality assurance review process we're currently in the process of aligning our CRM development practices with the guidance published by Microsoft - you can find the white paper here: http://www.microsoft.com/en-us/download/confirmation.aspx?id=39044

As part of that process we identified some areas around source control and Continuous Integration we needed to improve on:

1. Source Code Integration

Enable an automated extract of an unmanged solution from a local dev CRM server to disk for check-in to TFS.

2. Daily Automated Builds

Create a CRM deployment package based on a daily schedule using the latest source code in TFS.

3. Automate Build CRM Solution Package and Deploy to Target Server 

Create an automated pack CRM Solution from TFS and import to target CRM.

4. Web Resource editing in Visual Studio

Enable a developer to work on a web resource in VS and have the resource publish to CRM from the IDE.

5. Source Control Plugin Registration Settings

Enable a developer to source control plugin registration settings.

6. Automated Import and Publishing

Update deployment process to automate import and publish process.

We're currently working through the resolution for each of these issues with a combination of the Solution Packager, the xRM Framework for Continuous Integration and custom code but I'll write a post on each as we resolve them.

Friday, 3 January 2014

Renaming a standalone instance of Dynamics CRM 2011

As part of our development environment setup we recently needed to rename a stand alone instance of a CRM server and wanted to avoid re-installing. It's not the kind of thing you do very often so I figured I'd document it here for future reference.

NB. My instance was hosted on SQL Server 2012 but the steps should be the same in earlier versions.

*** HEALTH WARNING ***
This is unsupported: do not attempt this in any environment you can not afford to trash.
*****************************************************************************

The steps are as follows:


1. Rename the server and Reboot

If you are cloning your server you will need to remove it from the domain and rename it whilst it has no network connection to the domain controller. This will ensure the original server you are cloning from remains attached to the domain and working. You will also need to allocate this server a new IP address if it currently has a static one. You can then add this new server back onto the domain.


2. Fix SQL Server and Restart Services

a. In SQL Server Management Studio run the following SQL:
sp_dropserver <old_name>;
GO
sp_addserver <new_name>, local;
GO
b. Restart SQL Server Services.
c. Run SELECT @@SERVERNAME to confirm the rename has succeeded.
See http://technet.microsoft.com/en-us/library/ms143799.aspx for further details on 
renaming instances of SQL Server.

3. Fix Reporting Services

a. Open up Reporting Services configuration Manager
b. Ensure the server name in the connection dialogue points to your new server name.
c. Ensure Web Service URL is correct (it should be but there's no harm checking).
d. Click Database > Change Database > Choose an existing report server...
e. Enter your new server name into the connection dialogue
f. Choose ReportServer database and complete wizard.

See http://techontip.wordpress.com/2010/01/05/rename-sql-server-2008-single-server-senario/#more-253 for further details.


4. Update MS CRM Registry Entries

a. Run Regedit (Start > Run > Regedit)
b. Navigate to the MSCRM registry hive (HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ MSCRM)
c. Update the configdb and ServerUrl settings with your new server name.


5. Update MS CRM Configuration Database Settings

Open up SQL Server management studio and run the following script:

USE [MSCRM_CONFIG]
GO
 
UPDATE [Server] 
SET [Name] = '<NewServerName>';
 
UPDATE ConfigSettings 
SET [HelpServerUrl] = REPLACE([HelpServerUrl], '<OldServerName>','<NewServerName>');
 
UPDATE Organization 
SET [ConnectionString] = REPLACE([ConnectionString],'<OldServerName>','<NewServerName>'),
[SqlServerName] = '<NewServerName>', 
[SrsUrl] = REPLACE([SrsUrl],'<OldServerName>', LOWER('<NewServerName>'));

6. Update CRM Security Group Membership in Active Directory 

If you renamed your server whilst it was connected to the Domain Controller this step is not necessary (you might want to check though just to be sure).
a. Log onto your Domain Controller as a Domain Admin
b. Open up Active Directory Users and Computers and navigate to the Security Groups created by the original CRM installation process for your server. Eg. PriveReportingGroup, PrivUserGroup, SQLAccessGroup.
c. Open each group and add your new server as a member to each.
NB. You will need to select "Computers" as an Object Type.



7. Update Deployment Manager Web Address Properties

Open up CRM Deployment manager on your CRM server. Right click the root node "Microsoft Dynamics CRM" and choose properties. Click the Web Address tab and update the urls with the new server name.

8. Reboot your CRM Server

Navigate to CRM in your browser to confirm it's up and running. Choose and run a report to confirm SSRS is working too.