Step 1:
Navigate to ADFS server and open “Microsoft Dynamics 365 for Operations
On-premises” from Application Group.
Step 2:
click on Add Application and Name the application as describe your API
if custom service or OData as below screenshot!
Adding ADFS Application
Step 3:
Select Server Application and click Next.
ADFS Server Application
Step 4:
Copy generated Client Identifier (Application Id)
Enter Application URL without “/namespaces/AXSF”.
ADFS Application IdStep 5:
ADFS Secret
Step 6:
Authorize the new server application to use the Web API and request
OpenID connection authorizations.
ADFS Application WEB API Authorization
Step 7:
After completing this setup, its necessary configure the Azure Active
Directory applications.
System administration –> Setup –> Azure Active Directory
applications
And use the previously Client ID generated in the ADFS application.
Postman Configuration
Create a new environment with the following parameters.
Variable |
Value |
tenant_id |
adfs |
client_id |
«CLIENTID GENERATED IN THE ADFS APP» |
client_secret |
«SECRET GENERATED IN ADFS» |
resource |
Your AOS URL |
grant_type |
client_credentials |
Step 9:
Create a new Request to get Token.
In the body, set the reference to the global variables defined in the
environment configuration.
Key |
Value |
tenant_id |
{{tenant_id}} |
client_id |
{{client_id}} |
client_secret |
{{client_secret}} |
resource |
{{resource}} |
grant_type |
{{grant_type}} |
Step
10:
Copy the following script in Test.
var json = JSON.parse(responseBody);
tests[«Get Azure AD Token»] = !json.error && responseBody !== »
&& responseBody !== '{}' && json.access_token !== »;
postman.setEnvironmentVariable(«bearerToken», json.access_token);
To test if everything is ok, you can click on Send and the bearer token
is generated.
Key |
Value |
Content-Type |
application/x-www-form-urlencoded |
Step 11:
Test DataEntity
You can get data for any entity, you only need set the following
parameter in the Get
Type |
Odata URL |
Get |
{{resource}}/namespaces/AXSF/data/CustomersV3?$top=5 |
Header Parameters
Key |
Value |
Authorization |
Bearer {{bearerToken}} |
Content-Type |
application/json |