blueharoon
blueharoon

Reputation: 127

unable to create organisation programmatically through c# in crm 2011

public void Main2()
{
    DeploymentServiceClient service = Microsoft.Xrm.Sdk.Deployment.Proxy
        .ProxyClientHelper.CreateClient(new Uri("http://xxxxxxxxx:5555/XRMDeployment/2011/Deployment.svc"));
    Console.WriteLine(CreateOrganization(service
        , new Organization
        {
            UniqueName = "testOrgProv1",
            FriendlyName = "testOrgProv1",
            SqlServerName = "CRMDDC2",
            SrsUrl = @"http://crmddc2/Reports",
            BaseCurrencyCode = RegionInfo.CurrentRegion.ISOCurrencySymbol,
            BaseCurrencyName = RegionInfo.CurrentRegion.CurrencyNativeName,
            BaseCurrencySymbol = RegionInfo.CurrentRegion.CurrencySymbol,
            State = Microsoft.Xrm.Sdk.Deployment.OrganizationState.Enabled
        }));
}

Guid? CreateOrganization(IDeploymentService deploymentService
    , Organization org)
{
    BeginCreateOrganizationRequest req = new BeginCreateOrganizationRequest
    {
        Organization = org
    };

    BeginCreateOrganizationResponse resp = deploymentService.Execute(req) as BeginCreateOrganizationResponse;
    return resp != null ? (Guid?)resp.OperationId : null;
}

but I'm getting the error as

"The Deployment Service cannot process the request because one or more validation checks failed."

I'm using the local administrator account, it is also the deployment administrator,

ps: when I used similar code in a different way, the same error was popping but there the internal message was

"The current Active Directory user doesnt have read write permission on the reporting group ....."

Upvotes: 2

Views: 1592

Answers (3)

gregorius
gregorius

Reputation: 131

I had the same problem in CRM 2015 and spent many hours to find that there are still 2 additional steps needed beyond Mike_Matthews_II checklist, for CRM 2015.

In addition to Mike's step of... - Delegate Control to in AD of the OU containing PrivUserGroup and SqlAccessGroup...

...Do the same with the Reporting Group and the PrivReporting Group

For details, see... https://blogs.msdn.microsoft.com/niran_belliappa/2015/07/07/error-when-trying-to-remove-server-roles-in-dynamics-crm-2013/

(different situation, but similar error message)

Also, the original documentation for the setup steps for using the deployment service to create, etc. organizations is in the download at this link...

https://www.microsoft.com/en-us/download/confirmation.aspx?id=45022

In this document, look under the section "Minimum permissions required for Microsoft Dynamics CRM Setup and services: Deployment Web Service"

Note that this document neglects to mention the 2 additional steps I listed above.

Upvotes: 1

Felix
Felix

Reputation: 342

If you still had the same issues after following Mike_Matthews_II checklist, check the following:

  • Make sure the SQL Server has enough space.
  • In the SQL Server, make sure there is no existing database with the same name (saomething like SameDeploymentName_MSCRM).

In my test environment, these were throwing the same error message.

Upvotes: 0

Mike_Matthews_II
Mike_Matthews_II

Reputation: 732

I'm working through the same issue. I've found two articles that propose two different solutions:

This post reminds me of one of those links. In the first article, the author mentions that the deployment service (check IIS app pool) identity needs to have AD permission granted over the OU for the ReportingGroup.

To summarize the two articles:

  • Find the app pool identity for the CrmDeploymentServiceAppPool, henceforth <identiy>
  • Add the <identiy> to the Local Administrator and CRM_WPG groups
  • Delegate Control to <identiy> in AD of the OU containing PrivUserGroup and SqlAccessGroup
  • Grant <identiy> the "Log on as a Service" in the "secpol.msc" local rights management
  • Grant "sysadmin" privileges to the <identiy> in SQL server
  • Grant Read/Write permissions to <identiy> on the MSCRM_Web and Trace folders in your CRM
  • Grant Read/Write permissions to <identiy> in "regedit" on the entries HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM and HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\MSCRMSandboxService subkeys
  • Reset the App Pool
  • Run the scripts

If this fails to work, double check the links above, pray to God, then call MS Tech support (order is up to you). (Also, if you find something was missing, feel free to post or edit.)

Upvotes: 6

Related Questions