This is a brief example of how to use Postman on On-Premises environments and perform OData queries.
ADFS Setup
Now on ADFS server in my on-prem environment, I need to add a client application. From “AD FS Management” I see Application Groups, open the default application group for Dynamics 365 called “Microsoft Dynamics 365 for Operations On-Premises”, it will look something similar to this:
Put the AX URL as a Redirect URI without your “namespace/AXSF”
Copy the Client Identifier and the secret, you must need this information to setup the Active Azure Active Directory parameters
You must authorize the new server application to use the Web API and request OpenID connection authorizations
After complete 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 i.e “https://ax.d365ffo.onprem.contoso.com“ |
grant_type | client_credentials |
Create a first collation to request the authentication 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}} |
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 |
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 |
You can perform a test and the entity return the requested data.