How to make yourself a Dynamics CRM 2011 Deployment Administrator

Today I needed to deactivate one of our Dynamics organisations, but when I opened the Dynamics Deployment Manager, I received the following error:

"Only the Deployment Administrators are able to use Deployment Manager. You are not a Deployment Administrator.“

Bummer. I did a bit of Googling and found this post by Ronald Lemmen (thanks for pointing me in the right direction!).  Since the Dynamics Deployment Manager is obviously checking the MSCRM_CONFIG database for this information I attached a database trace to it and found that it’s executing these queries (among many others):

exec sp_executesql N’SELECT  Id, [DefaultOrganizationId], [IsDisabled], [Name]  
FROM [SystemUser]  
WHERE ((([Name] = @Name0)) ) AND (IsDeleted = 0) ‘,
N’@Name0 nvarchar(41)',@Name0=N’{My windows domain account}‘

exec sp_executesql N’SELECT  Id, [Name], [UniqueifierId]  
FROM [SecurityRole]  
WHERE ((([Name] = @Name0)) ) AND (IsDeleted = 0) ‘,
N’@Name0 nvarchar(13)',@Name0=N’Administrator'

exec sp_executesql N’SELECT  Id  
FROM [SystemUserRoles]  
WHERE ((([SecurityRoleId] = @SecurityRoleId0) AND ([SystemUserId] = @SystemUserId1)) ) AND (IsDeleted = 0) ‘,
N’@SecurityRoleId0 uniqueidentifier,@SystemUserId1 uniqueidentifier’,
@SecurityRoleId0=’{ID of Admin Role}',@SystemUserId1=’{ID of my SystemUser record}‘

From there it was actually a pretty simple task: insert a couple records to SystemUser and SystemUserRoles to indicate that my domain account is in the “Administrator” role

(Name, IsDeleted, DefaultOrganizationId, Id, IsDisabled) VALUES
('{My windows domain account}', 0, ‘00000000-0000-0000-0000-000000000000’, NEWID(), NULL)

INSERT INTO [SystemUserRoles]
(Id, SecurityRoleId, SystemUserId, IsDeleted) VALUES
(NEWID(), ‘{ID of Administrator Role}', ‘{ID of the SystemUser record just created}', 0)

And now I can open Dynamics CRM Deployment Manager!