> For the complete documentation index, see [llms.txt](https://docs.appstrategy.com/apprules-r-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appstrategy.com/apprules-r-documentation/appendix/miscellaneous/oauth-authentication-azure-definition.md).

# Dynamics365 - Connection Settings

Used by most of Microsoft Dynamics 365 applications

### Connect using Azure AD

#### 1 - Define an App in Azure and get your oAuth values

Use the values defined in the [Dynamics365 App Registration](/apprules-r-documentation/appendix/miscellaneous/dynamics365-app-registration.md) to get the OAuth client id and secret

#### 2 - Get the OAuth Access Token in appRules

#### 2.1 - Standard oAuth Flow

Use [Getting the oAuth Access and Refresh Tokens](/apprules-r-documentation/appendix/miscellaneous/getting-the-oauth-access-and-refresh-tokens.md)in order to get the proper connection properties

#### 2.2 - Client OAuth Flow

Client credentials refers to a flow in OAuth where there is no direct user authentication taking place. Instead, credentials are created for just the app itself. All tasks taken by the app are done without a default user context. This makes the authentication flow a bit different from standard.

All permissions related to the client oauth flow require admin consent.&#x20;

In your App Registration in portal.azure.com, navigate to API Permissions and select the Microsoft Graph permissions. There are two distinct sets of permissions - Delegated and Application permissions. The permissions used during client credential authentication are under Application Permissions. Select the applicable permissions you require for your integration.

### Connect using MSI Authentication

If you are running the source on an Azure VM, you can leverage Managed Service Identity (MSI) credentials to connect:

* AuthScheme: Set this to **AzureMSI**.

The MSI credentials will then be automatically obtained for authentication.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.appstrategy.com/apprules-r-documentation/appendix/miscellaneous/oauth-authentication-azure-definition.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
