Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Suggested answer

How to use application user credential to call Web API?

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?

  • Suggested answer
    Nya Profile Picture
    Nya 29,056 on at
    RE: How to use application user credential to call Web API?

    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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans