web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

[Help] Creating Connection String

(0) ShareShare
ReportReport
Posted on by

For the past week I've been following every video, and tutorial on the web and have not been able to create a successful connection string.

My company has a server established remotely and when i try to connect to our test environment it will not successfully authenticate the string.

Here is the setup:

  • The address for the computer itself is set up as: "Test.company.com"  <-----*This just points to the server as shown below.*

IIS

  • The address used to log into the CRM installed in that machine is: "CRMTest.company.com"
  • The CRM server is using AD authentication so we type our usernames like so: ad\username

7411.q.PNG

  • Once logged in CRM shows in the "About" section: "This program is liscenced to organization: CRMTest"

With all this information I should be able to create the string no problem, but

Whenever I try to make the connection string it won't log on, it'll find the server, but refuses to authenticate any help would be appreciated.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,188 Moderator on at
    RE: [Help] Creating Connection String

    When you say, you are trying to create a connection string, this is in order to develop a custom solution using the SDK?

    Since you are using ADFS, you are set to https and IFD (based on the url above):

    You connection string should be as follows (inside you app.config):

     <connectionStrings>

       <add name="Server=company.com, organization=crmtest, user=admin@company.local"

            connectionString="Url=server.company.gov/.../Organization.svc; Username=ad\admin; Password=CRM_PASSWORD; authtype=IFD"/>

     </connectionStrings>

     <appSettings>

       <add key="UserName" value="ad\admin"/>

       <add key="EncryptedPassword" value="SADWTZWDpPusc4rFx0DT8g==" />

       <add key="InternalUrl" value="server.company.com"/>

       <add key="OrgName" value="crmtest"/>

     </appSettings>

    Your application settings above are options since there are multiple ways to connect to environment:

    Make sure to add reference to Microsoft.Xrm.Tooling.Connector (in using section)

    Connect using Connection String:

    connectionString = connectionString.Replace("CRM_PASSWORD", CRM_PASSWORD);

    CrmServiceClient conn = new CrmServiceClient(connectionString);

    Connect using Application Settings:

    string userName = ConfigurationManager.AppSettings["UserName"].ToString();

    string internalUrl = ConfigurationManager.AppSettings["InternalUrl"].ToString();

    string orgName = ConfigurationManager.AppSettings["OrgName"].ToString();

    NetworkCredential creds = new NetworkCredential(userName, ConvertToSecureString(CRM_PASSWORD));

    AuthenticationType authType = AuthenticationType.IFD;

    CrmServiceClient conn = new CrmServiceClient(creds, authType, internalUrl, "443", orgName, true, true, null);

    After the CrmServiceClient has been established, set the Organization Service:

    _orgService = (IOrganizationService)conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;

    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans