Thursday, March 17, 2016

Warehouse Mobile Devices Portal for Microsoft Dynamics AX

In this post, I will cover how to configure mobile device portal for Dynamics AX RTW.

Follow the steps mentioned in here. Once you are done with the steps mentioned, You might still wont be able to login to WMS portal due to errors.

In that case you need to look at the event viewer for errors. They are described below with the resolution.

Error: "Unknown type"

Resolution: Make sure user details are correct in the Web.config. Details should look like below

Error: "Error validating credential, Password is expired"

Resolution: This scenario comes due to 2 cases
  • When you have created a new user, Azure provides a temporary password. You cannot login using this temporary password and needs to be changed. To do this you can login using your new user into any site where you have access for e.g. You will be asked to change the password. Once you change it you should be able to use this new user and password in WMS portal.
  • When you password is expired. In this case, follow the same procedure as above to update the password. After that you should be able to use this user for WMS portal.
Error: "Error occurred when processing web request. Status code: Forbidden"

Resolution: You get this error when, user is not added in AX RTW. Create a user and error will be resolved.

Error: "Error occurred when processing web request. Status code: Unauthorized"

Resolution: You get this error when user doesn't have proper role in AX RTW. Assign the warehouse mobile device user role.
Error: "The user or administrator has not consented to use the application with ID '<GUID>'. Send an interactive authorization request for this user and resource.

Resolution: When you login for the first time into WMS portal (in turn Native APP on Azure), User has to give consent before they can proceed. From what I understood, Till Jan/Feb you would not get this error if you give username and password from the code but there has been some updates and after that user consent is necessary. To give the user consent you need a C# solution. Follow the steps below to create a new solution.

Create a new console application.

Click on the tools-> NuGet package Manager -> Manage NuGet Packages for Solution.
Search for the nugget Package Microsoft.IdentityModel.Clients.AciveDirectory.
Install it for your current project.

Now copy paste the following code to program.cs in the project.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
namespace ConsoleApplication1
class Program
static void Main(string[] args)
UriBuilder uri = new UriBuilder("<domain>");
AuthenticationContext authenticationContext = new AuthenticationContext(uri.ToString());
//request token for the resource - which is the AX URI for your organization. NOTE: Important do not add a trailing slash at the end of the URI
AuthenticationResult authenticationResult = authenticationContext.AcquireToken("<URL of Dynamics AX>", "<app id from Azure>", new Uri("<uri of App in Azure>"));
//this gets the authorization token, which needs to be passed in the Header of the HTTP Requests
string authenticationHeader = authenticationResult.CreateAuthorizationHeader();

Replace the <domain>, <URL of Dyanmics AX>, <app id from Azure > and <uri of app in Azure> as per your details. It looks like below:

Save and Run the console app(shortcut to run is Ctrl+F5).

A new window will pop up asking the user name and password.

Fill in your user name and password. Click on sign in. A new screen will appear asking for the consent. Click accept.

Now you should be able to login to WMS portal.

Choose your company here.

You may get error like below:

Naviagte to Warehouse management -> Setup -> Mobile device -> Mobile device display settings and make sure record is created as shown in the screenshot below

Name : <anything>
Default checkbox : Selected
CSS file: defaultrf.css
Mobile device disply settings: DisplayIEOS

Now if you refresh the WMS portal site, you should be able to login:


  1. Vinit, can you post a screenshot of that "consent" window that pops up? I am curious. Tnx

    1. Hi Ivan, unfortunately I missed taking screenshot and I wont get it again till a new user is setup. Currently, I am too busy with project work once I get some time I will try to post it.

  2. Great write-up, but I think we should make deployment a bit easier than this : )

    1. Hi Eugene, We would always love things easier :) but I think All this is required considering the Cloud architecture. I struggled to install it for the first time, later it wasn't so bad :)

  3. Is there a device compatibly/requirements list somewhere so I know what mobile devices (warehouse scanners) are supported?

  4. Hi. I'm not having the authenticationContext.AcquireToken method. Only have methods like AquireTokenAsync, but diffrent vars needed. Any suggestions?

  5. This comment has been removed by a blog administrator.

  6. Hi

    I got the issue "Sorry, an error occurred while processing your request. Please retry your request or contact your system administrator. "

    and in the event viewer:

    Exception information:
    Exception type: AdalServiceException
    Exception message: AADSTS70002: The request body must contain the following parameter: 'client_secret or client_assertion'.
    Trace ID: 9394dfe7-3247-4f0d-b06c-6b2479783a00
    Correlation ID: 12e9c762-1086-4a1d-8a1a-c3f106d12dce
    Timestamp: 2017-06-27 10:49:38Z
    at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.RunAsyncTask[T](Task`1 task)
    at Microsoft.Dynamics.AX.Whs.Web.Service.ServiceClient.GetAuthenticationHeaderValue()
    at Microsoft.Dynamics.AX.Whs.Web.Service.ServiceClient.d__2`1.MoveNext()

    The remote server returned an error: (401) Unauthorized.
    at System.Net.HttpWebRequest.GetResponse()
    at Microsoft.IdentityModel.Clients.ActiveDirectory.HttpWebRequestWrapper.d__2.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.IdentityModel.Clients.ActiveDirectory.HttpHelper.d__0`1.MoveNext()

    Request information:
    Request URL: https://localhost:8999/ContextSetup/SelectCompany
    Request path: /ContextSetup/SelectCompany
    User host address: ::1
    Is authenticated: False
    Authentication Type:
    Thread account name: IIS APPPOOL\Operations - Warehouse Mobile Devices Portal DEFAULT

    Thread information:
    Thread ID: 10
    Thread account name: IIS APPPOOL\Operations - Warehouse Mobile Devices Portal DEFAULT
    Is impersonating: False
    Stack trace: at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.RunAsyncTask[T](Task`1 task)
    at Microsoft.Dynamics.AX.Whs.Web.Service.ServiceClient.GetAuthenticationHeaderValue()
    at Microsoft.Dynamics.AX.Whs.Web.Service.ServiceClient.d__2`1.MoveNext()

    Could you pls advise this ? thanks


  7. Hi,
    Thanks for this blog,
    i am facing an issue. I have copied your all code but on the following line it gives error that AcquireToken method doesn't exist. some other methods are there. AcquireTokenAynch etc. what could be the problem.

    AuthenticationResult authenticationResult = authenticationContext.AcquireToken(a,b,c)