LogoLogo

Our Products

Metadata Browser

Edge Add-on

HTML To PDF Converter

Power Automate Connector

Data Mask for Dataverse

Dataverse App

Commission 365

Dynamics 365 App

AI Autocloser

Dataverse App

Flow Monitor

Power Automate App

ServicesAboutCareersBlogContact
Chat on Teams
Metadata BrowserHTML To PDF ConverterData Mask for DataverseCommission 365AI AutocloserFlow Monitor
ServicesAboutCareersBlogContactChat on Teams
HomeBlogConnect Dynamics 365 to Console App Using Application Registration

Connect Dynamics 365 to Console App Using Application Registration

November 14, 2024
#Dynamics 365#Azure
Soumya Das
Connect Dynamics 365 to Console App Using Application Registration

Connecting a console application to Dynamics 365 allows you to work with Dynamics 365 data directly within your application. In this blog, we will use Application Registration and Application User to authenticate the connection and access data securely, without needing to re-enter user credentials every time.

Here are a few prerequisites for you to follow:

Dynamics 365 Environment: You must have access to a Dynamics 365 instance, either as an administrator or with sufficient privileges to create and manage users.

Connect Dynamics 365 to Console App Using Application Registration 01

Azure Active Directory (Azure AD) Account: You need an Azure AD tenant for managing identities and applications. If you are using Dynamics 365, you are already set up with an Azure AD account.

Connect Dynamics 365 to Console App Using Application Registration 02

Administrator Access to Azure AD: To register an application in Azure AD and grant it permissions, you’ll need administrator access to Azure AD or the appropriate permissions to register applications.

Connect Dynamics 365 to Console App Using Application Registration 03

Visual Studio or C# Development Environment: You will need a development environment set up with Visual Studio or a similar IDE to build and run the console application.

Need help with your business solution?

Our team can help you implement the right solution for your organization.

Get in touch
LogoLogo

Ex-Microsoft experts helping businesses get more from their Dynamics 365 and Power Platform investments.

Products

Connect Dynamics 365 to Console App Using Application Registration 04

.NET Framework or .NET Core: Depending on the version of your console application, ensure you're working with .NET Framework or .NET Core that supports the required libraries for authentication and connecting to Dynamics 365.

Connect Dynamics 365 to Console App Using Application Registration 05

Required NuGet Packages: Your console application will need certain NuGet packages for working with OAuth authentication and Dynamics 365.

Connect Dynamics 365 to Console App Using Application Registration 06

Step-by-Step Guide to Connect Dynamics 365 with a Console Application:

First, head over to the azure portal and log in to your account. In case it is your first time; you can start with a trial account first.

Connect Dynamics 365 to Console App Using Application Registration 07

Search for App Registrations on the search bar and click on the icon in the results or press Enter.

Connect Dynamics 365 to Console App Using Application Registration 08

Click on New Registration.

Connect Dynamics 365 to Console App Using Application Registration 09

Provide a display name, select the type of access, and optionally choose a Redirect URI (incase you are using services like Postman, etc.).

Connect Dynamics 365 to Console App Using Application Registration 10

Once done, go back to the app registration and you will find the app under All applications. Click on it.

Connect Dynamics 365 to Console App Using Application Registration 11

Once you click on it, the app registration dashboard will open. Go to Manage – Certificates & secrets – Click on New Client Secret.

Connect Dynamics 365 to Console App Using Application Registration 12

Add a Description, choose an expiration date, and click on add.

Connect Dynamics 365 to Console App Using Application Registration 13

Once added, copy the ClientSecret value and save it locally on a notepad as it gets masked later on.

Connect Dynamics 365 to Console App Using Application Registration 14

Go to the Overview ribbon and copy the app/ ClientID as well, locally.

Connect Dynamics 365 to Console App Using Application Registration 15

This completes the first phase of the integration; in the second phase, you will have to add this app to your environment. For this, go to admin.powerplatform.microsoft.com – Environments and copy the environment URL on your notepad.

Connect Dynamics 365 to Console App Using Application Registration 16

Next, go to settings and click on Application Users under Users + permissions tab.

Connect Dynamics 365 to Console App Using Application Registration 17

Once you click on New app user, a new screen opens on the right. Click on Add an app.

Connect Dynamics 365 to Console App Using Application Registration 18

Select your app and add.

Connect Dynamics 365 to Console App Using Application Registration 19

Choose your Business Unit and Security role as well and click on Create. Make sure the chosen security role has privileges in the business unit.

Connect Dynamics 365 to Console App Using Application Registration 20

Once done, your app will reflect in the list as shown below.

Connect Dynamics 365 to Console App Using Application Registration 21

With this the second phase of this integration comes to an end. Finally, we need to connect them using a Dynamics 365 Console Application. Head over to Visual Studio 2022 (choose the latest version) and create a new project. Choose Console App in .NET Framework.

Connect Dynamics 365 to Console App Using Application Registration 22

Give your Project a name, choose repository/ path, and framework (It is advised to choose 4.6.2 or 4.8 framework as of the latest update).

Connect Dynamics 365 to Console App Using Application Registration 23

Download Microsoft Xrm Tooling from the NuGet Package Manager.

Connect Dynamics 365 to Console App Using Application Registration 24

Before connecting to the environment, you will also need the authority id (or redirect URI) which you can find in the Overview Section – go to endpoints and copy the portion of the URL as shown below.

Connect Dynamics 365 to Console App Using Application Registration 25

Write the code within the default Program.cs in your VS to establish the connection.

Connect Dynamics 365 to Console App Using Application Registration 26

To check for the connection is established or not, you can create a CrmServiceClient object using the provided connection string to connect to the Dynamics 365 CRM environment and click on Start play button.

Connect Dynamics 365 to Console App Using Application Registration 27

If the connection is established, the same message will reflect on the console.

Connect Dynamics 365 to Console App Using Application Registration 28
Frequently Asked Questions (FAQs):
1. What is Application Registration used for in this process?

Application Registration in Azure AD provides the Application ID and Secret needed for the console application to authenticate with Dynamics 365.

2. Why do we need an Application User in Dynamics 365?

The Application User allows the registered application to access Dynamics 365 data based on assigned permissions.

3. Can one application connect to multiple Dynamics 365 environments?

Yes, by creating separate Application Users for each environment and configuring the application to switch between them.

4. Why not use user credentials for this connection?

Using Application Registration is more secure, avoids storing user credentials, and is better for automated processes.

5. Can this setup be used for real-time data updates?

Yes, the application can interact with Dynamics 365 in real time, depending on how the API calls are structured and the application is configured.

Back to all articles

More from the blog

Generate Temporary Download URLs in Dynamics 365 Using GetFileSasUrl

Enable Audio Playback in Dynamics 365 Contact Forms Using JavaScript

Email Smarter in Outlook with Sales Copilot and Power Apps Integration

Creating And Embedding a Copilot Bot in Dynamics 365

Close Case on condition using Power Automate

Understanding and Using Polymorphic Lookups in Dynamics 365 with XrmToolBox

Migrating Data from Dynamics 365 Business Central to Dynamics 365 Sales and Microsoft Dataverse

Integrating Your Copilot Agent with Teams

Metadata Browser
  • HTML To PDF Converter
  • Data Mask for Dataverse
  • Commission 365
  • AI Autocloser
  • Flow Monitor
  • Services

    • D365 Marketing
    • D365 Sales
    • D365 Customer Service
    • D365 Field Service

    Company

    • About Us
    • Blog
    • Contact
    • Careers

    Copyright ©2026 Pascalcase Software Private Limited. All rights reserved.

    Privacy PolicyTerms of Service