# Authorize Dynamics 365 F\&O

## 1. Find your Microsoft Dynamics Environment URL

Your environment URL is the base address of your D365 F\&O instance. To find it, copy the URL from your browser when you are in the application.

Examples:

* Production: `https://yourorg.operations.dynamics.com`
* Sandbox: `https://yourorg.sandbox.operations.dynamics.com`

### 2. Select Dynamics 365 Finance

In Stacksync:

1. Click **Create Sync**
2. Choose **Dynamics 365 Finance & Operations**<br>

   <figure><img src="/files/Q1SwnvvnzX1fWHg5Ocu4" alt=""><figcaption></figcaption></figure>

This opens the authorization flow.

***

### 3. Enter Your Environment URL

Provide the base URL of your D365 Finance & Operations environment you retrieved in the first step.<br>

<figure><img src="/files/Yvx9CTyMqQ0gF6QTAVqC" alt=""><figcaption></figcaption></figure>

Click **Authorize App**.

***

### 4. Sign In with Microsoft

You will be redirected to Microsoft’s login page.

1. Enter your Microsoft credentials
2. Continue to the permissions screen

This authenticates you as a valid D365 user.

***

### 5. Grant Stacksync Access

Microsoft will ask you to approve the Stacksync app.

Click **Accept** to authorize:

* Permission to read ERP data
* Permission to interact with OData entities

If you see this message:

> *“Need admin approval for this app.”*

Ask your admin to:

* Open the Microsoft identity / directory admin portal and go to the **enterprise applications / app registrations** area.
* Locate the **Stacksync** application or the corresponding app registration.
* Review and grant the requested API permissions (for example, access to Dynamics 365 F\&O APIs).

Once an admin has granted consent, the “Need admin approval” screen will no longer appear when you authorize Stacksync. You can then restart the authorization from step 2, and the flow will complete successfully, allowing Stacksync to connect to your Microsoft account and start syncing data.

If you have any questions or run into any blockers, reach out anytime at <hello@stacksync.com> and the Stacksync team will be happy to help.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stacksync.com/two-way-sync/connectors/dynamics-365-finance-and-operations/authorize-dynamics-365-f-and-o.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
