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

Announcements

News and Announcements icon
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,064 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 51 Super User 2026 Season 1

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 51 Most Valuable Professional

#3
Nagaraju_Matta Profile Picture

Nagaraju_Matta 50

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans