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

Announcements

No record found.

News and Announcements icon
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,190 Moderator on at

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans