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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

How to use application user credential to call Web API?

(0) ShareShare
ReportReport
Posted on by 35

hi,

I have created the application user in Dynamic 365, and now i wish to write the connection string to connect to the Dynamic Environment using Web API. Anyone know how to write the connection string in C# App.config? 

If i already have Application User, do i still need to fill in the UserPrincipalName and Password?

I have the same question (0)
  • Suggested answer
    Nya Profile Picture
    29,060 on at

    Hi,

    Please make sure that the application has been registered in Azure Active Directory admin center: Tutorial: Register an app with Azure Active Directory (Microsoft Dataverse) - Power Apps | Microsoft Docs

     

    Then the connection code is something like:

    {
        "ConnectionStrings": {
            "CrmOnline": "Url=https://yourorganization.crm.dynamics.com/; Username=name@xxx.onmicrosoft.com; Password=password"
    	    },
        "AppSettings": {
            "ClientId": "yourclientid",
            "RedirectUrl": "yourredirectUrl"
    	    }
    }
     

    ClientId: ‘Application ID’ from Azure AD,  generated in above section.

    RedirectUrl: set in the registration.

     

    Here is a complete sample you can refer to:

    GitHub - mischameyer/sample-dynamics365-webapi-caller-dotnet461: Simple .NET Client (console) with .NET 4.6.1 to connect to an existing dynamics365-instance and get all contacts from a REST-Api (GET).

     

    If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.

    Best Regards,

    Nya

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 35 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 27 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 13 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans