Skip to main content

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

INSERT INTO [MSCRM_CONFIG].[dbo].[SystemUser]
(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!

Comments

  1. Thank you, man, you save my life !

    ReplyDelete
    Replies
    1. You're welcome! Glad I could help :)

      Delete
  2. Thanks for this post.
    -I demoted an AD from the server running Dynanmics 365 on-premise installation and promoted the server to another Domain controller.
    -I am now locked out.
    -The solution explained here does not work for me on Dynamics 365. Also, the columns change if an organization is using some other DB other than the default MSCRM_CONFIG
    - How did you trace the SQL query being called for checking the permission by CRM deployment manager?

    ReplyDelete
    Replies
    1. Dang, sorry that my little hack wasn't helpful in your situation :(

      It's understandable that a lot of things have changed in the database architecture between Dynamics 2011 and 365, and tricks like this are probably not even advisable on the version they were written for!

      I use SQL Server Profiler to trace database queries, but I'm not sure if this will work with Dynamics 365 since you need to connect directly to the database and have the ALTER TRACE permission. More info here if it helps: https://docs.microsoft.com/en-us/sql/tools/sql-server-profiler/create-a-trace-sql-server-profiler

      Delete

Post a Comment

Popular posts from this blog

Using Log4Net to use both event log and a rolling log file

Here's the config section, note that the applicationNameproperty in the EventLogAppender needs to be the same as the event source in the windows event log that you want to log to.  If the event source doesn't exist, that appender won't work.  In this particular project I create that during install using WiX (which is covered in another post)

  <log4netdebug="true">
    <appendername="RollingLogFileAppender"type="log4net.Appender.RollingFileAppender">      <filevalue="log.txt" />      <datePatternvalue="dd-MM-yyyy" />      <appendToFilevalue="true" />      <locationinfovalue="false" />      <rollingStylevalue="Size" />      <maximumFileSizevalue="1MB" />      <maxSizeRollBackupsvalue="10" />      <staticLogFileNamevalue="true" />      <layouttype="log4net.Layout.PatternLayout">        <conv…

Using WiX to create an event source during install of a .NET framework project

Edit: so I guess I wasn't the only one confused with this stuff, as it's been my most popular post by far!  If I've helped you out or saved you some time, please let me know in the comments :)

In order for this to work, you have to add references to WixUtilExtension and WixNetFxExtension to your WiX project.  Once that's done, add this inside a <Component> element:

<Util:EventSourcexmlns:Util="http://schemas.microsoft.com/wix/UtilExtension"Name="EVENTSOURCEGOESHERE"Log="Application"EventMessageFile="[NETFRAMEWORK40FULLINSTALLROOTDIR]EventLogMessages.dll" />
Obviously replace EVENTSOURCEGOESHERE with your event source name.  NETFRAMEWORK40FULLINSTALLROOTDIR is a property set by the WixNetFxExtension which stores the path to the .NET framework v4 directory, but you can replace this with the corresponding property for the directory containing the relevant EventLogMessages.dll file.  So if you're using the .NET framewo…

Umbraco Deployment Checklist

This is primarily aimed at deploying from Visual Studio to an Azure Web App + Azure SQL database, feel free to skip bits that aren't relevant if you're doing other things.

Prerequisites for developing locally:
Visual Studio (obviously)
Ensure IIS URL Rewrite module is installed using web platform installer (other downloads from MS documentation don't seem to work)

Set up Azure:
Make a new SQL Database in Azure, take note of the server name, database name, admin login and admin password.  If you already have a server and resource group, automate with Powershell as shown below (you'll need to replace the param values):
New-AzureRmSqlDatabase -DatabaseName "UmbracoDatabase" -ServerName "TheServer" -ResourceGroupName "Whatever" -Edition "Basic"
Add your IP to the Azure SQL db firewall so Umbraco can connect to it later when running locally
Create a new Azure web app, either manually or via Powershell:
New-AzureRmWebApp -ResourceGroupName…