I needed a way to integrate with Dynamics 365 Business Central and a .Net application running in Azure. (see Deploying .NET Applications To Azure), these are the high level steps.
Entra
Access
Your user will need the following access
- Access to the tenant
- Needs the roles
Application Administrator
andCloud Application Administrator
App Registration
- Register the application in Entra, you will need the application (client) ID, its a GUID, example
00000000-0000-0000-0000-000000000001
- Optionally set App Roles if required, see Entra RBAC For Applications
- Create the app secret and set its expiry date, the secret is a string, example
SSs00~SSSSSSSSSSSssssssssss.SSSSSsss~Sss
- Set the API permission
1 | AdminCenter.ReadWrite.All |
- https://learn.microsoft.com/en-nz/dynamics365/business-central/dev-itpro/administration/administration-center-api
- https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/configure-user-consent
Testing with postman
- Construct the request
1 | POST: https://login.microsoftonline.com/{{tenant-id}}/oauth2/v2.0/token |
Optional test to set the JWT
1 | function main(){ |
- Validate token
Example roles as seen when running the token through https://jwt.io/
1 | "roles": [ |
Dynamics
- Set up the Microsoft Entra application in Business Central
Example permission
1 | ADMINISTRATOR |
Dyanamis API
Using the token as a bearer you can then make requests, these are all GET and {{env}}
can be production|sandbox
Base to discovery the API and get all companies
1 | https://api.businesscentral.dynamics.com/v2.0/{{env}}/api/v2.0 |
Then to find some data using a company-id
from the above, it will be a guid, example 00000000-0000-0000-0000-000000000002
. You can also filter by sales-quote-id
which is also a guid, example 00000000-0000-0000-0000-000000000003
1 | https://api.businesscentral.dynamics.com/v2.0/{{env}}/api/v2.0/companies({{company-id}})/salesQuotes |
It also supports filters
1 | # Number greater than 430 |