Sunday, May 1, 2016

Purpose: The purpose of this article is to illustrate how to configure Warehouse Mobile Device Portal in New Microsoft Dynamics AX and quickly make it available on mobile devices for the purposes of POC (Proof of Concept), demonstration or workshop using Demo environment

Scenario: Often times for the purposes of POC (Proof of Concept), demonstration or workshop it is needed to configure Warehouse Mobile Device Portal in New Microsoft Dynamics AX Demo environment. In this article we’ll explore nuances of how to set up Warehouse Mobile Device Portal in New Microsoft Dynamics AX Demo environment, and what are the options while setting up your demonstration scenarios

Also there’s a registered domain name for alexaos.cloudax.dynamics.com that translates to a particular public IP address

Cmd - ping

If we look at the respective VM HTTPS endpoint is enabled by default on standard port 443

Azure VM HTTPS Endpoint

Okay, we looked around the setup available by default, and now we’ll set up WMDP (Warehouse Mobile Devices Portal) first to work in a web browser on the VM, then to work on the device outside of the VM and finally run WMDP in simulation mode from within New Microsoft Dynamics AX user interface

In order to enable download, we’ll change Internet Explorer web browser settings (Internet options > Security tab > Internet (zone) > Custom level) and enable appropriate radio buttons. Please note that for the purposes of POC in this walkthrough it is fine, in fact security settings of web browser will be managed differently and strictly for Production environments to ensure maximum level of protection

When Download Warehouse Mobile Devices Portal installer windows pops it will provide a checklist of security best practices which need to be followed for Production environments. But again for the purposes of POC in this walkthrough we’ll mark all checkboxes to get past this step and begin download

Download Warehouse Mobile Devices Portal installer

Once WarehouseMobileDevicesPortal.msi is downloaded we can begin installation process

At this point if we try to access WMDP in a web browser on https://localhost:9999 we’ll get an error because WMDP has not been configured yet

WMDP

For the purposes of experiment, we’ll also add additional HTTP binding on port 9998

Add Web site Binding (HTTP)

Now WMDP IIS Web site bindings will look like the following

Site Bindings

IIS Manager > WMDP

Now we should configure WMDP before we can use it

One of the steps in configuration process is to register an app for WDMP. In order to do that we’ll log into Microsoft Azure portal and navigate to Active Directory

Active Directory

Next we’ll open Add application dialog on Applications tab

Active Directory > Applications

On Add application dialog we’ll select Native client application

Add application – Tell us about your application

For the purposes of POC in this walkthrough we’ll specify a fake redirect URL

Add application – Application information

Now application has been registered and we’ll navigate to Configure tab to retrieve necessary information and do additional setup

Application

On Configure tab we’ll take a note of Client ID GUID (which will be required on the subsequent steps) and also assign appropriate permissions for the application

Application > Configure

Specifically, we’ll add Microsoft Dynamics ERP as application

Permissions to other applications

And assign 3 permissions to it as shown below

Permissions to other applications

Let’s assume Client ID GUID is “XYZ” for simplicity of explanation

At this point with all necessary info on-hand we can modify Web.config file for WMDP. We can very quickly get to the file system folder where Web.config for WMDP resides by right clicking WMDP Web Site in IIS Manager and selecting Explore to open file explorer window

IIS Manager > Sites > WMDP > Explore

Here’s Web.config file we need to modify

File explorer > Web.config

In Web.config file at minimum we need to provide a few pieces of information required for configuration. They are: Service reference URI, Auth service security resource, Service client ID (GUID we registered and memorized earlier), Service user name, Service user password (for the sake of simplicity for the POC we’ll specify Admin user credentials), Service auth URL. Pretty much everything is very straightforward. Speaking about Service auth URL, for example, if our domain is “microsoft” we’d specify “https://login.windows.net/microsoft.onmicrosoft.com”, or if our domain is “contosoax7” we’d specify “https://login.windows.net/contosoax7.onmicrosoft.com”. You can also see this name when you are logging in into Microsoft Azure portal, for example, https://manage.windowsazure.com/microsoft.onmicrosoft.com#Workspaces/All/dashboard. So it is easy to locate

This is how modified Web.config file will look like. Please note that I removed PublicKeyToken values from the text below to simplify reading (…)

We’ll also do an additional step in HTTPS Binding configuration by adding a host name (I reused the original AOS host name for the sake of simplicity for the purposes of POC) and SSL certificate (I reused the original AOS SSL certificate for the sake of simplicity for the purposes of POC)

Our next step will be to load web application configuration according to modified Web.config file. For these purposes we’ll select “Load web application configuration” link

Web configuration loading

As the result we’ll see the following message: “Web configuration was loaded successfully. If there are any service user credentials stored in Web.config file, they should be removed now. Please set ServiceUserName and ServiceUserPassword to empty string.”. As suggested now it will be a good time to remove Admin credentials we used from Web.config file

Then we’ll reload WMDP and select “Log on to the mobile device” to select company in case of multi-company setup

Select company

For the sake of this walkthrough we’re using a standard demo data set and we’ll select USMF company that has enough data pre-set up for us to continue

Sign in to AX (USMF)

On Sign in to AX screen we’ll provide valid Warehouse user credentials and then we can continue with our functional scenarios. This is great! But I’m curious if for the purposes of POC we can run WMDP via HTTP instead of HTTPS. That’s why I’ll repeat the process using HTTP URL

Log on to the mobile device (HTTP)

Select company (HTTP)

As the result I’ll be getting the following error: “Sorry, an error occurred while processing your request. Please retry your request or contact your system administrator”

Microsoft Dynamics AX Warehouse Mobile Devices Portal: Error

If we look into Event Viewer we’ll find an explanation for this error: “Exception type: HttpAntiForgeryException, Exception message: A required anti-forgery token was not supplied or was invalid”

Event Viewer

Exception

Exception information:

Exception type: HttpAntiForgeryException

Exception message: A required anti-forgery token was not supplied or was invalid.

WMDP is meant to be run via HTTPS, and we’ll switch to HTTPS for further steps

Great! We can run WMDP via HTTPS, but for convenience if inside of the VM we can introduce a dedicated host name for it, for example, “alexwmdp.cloudax.dynamics.com”. In order to do that we can change Hosts file

Hosts file

And modify binding appropriately

Binding (Change)

Site Bindings

Now the same WMDP Web site is accessible via a new URL from within the VM thanks for translation introduced in Hosts file

Microsoft Dynamics AX Warehouse Mobile Devices Portal

Select company

Sign in to AX (USMF)

It is more convenient to use a meaningful name like “alexwmdp”, in fact if we want to access alexwmdp.cloudax.dynamics.com from outside of the VM this name will obviously not be resolved

In order to achieve that we’ll change WMDP Web site binding as shown below

WMDP Web site

Site Bindings

Edit Site Binding

Please note that I’m still reusing the original SSL certificate which is going to give us Certificate warning in the future because this certificate is registered for a different domain name. In fact this will be fine for the purposes of this POC

In order to register a new domain name we’ll use one of domain registrars, in my case I already have Blogger web page open so I used Google domain registrar: https://domains.google.com to register alexwmdp.com domain that I’m going to use for WMDP

Domain

Please note that domain registrars will charge you a periodic fee for keeping your domain name after registration (fee amount may vary depending on domain registrar). Once domain name has been picked we can set up DNS records for subdomains. In particular, I wanted to use https://demo.alexwmdp.com to access WMDP. That’s why I’ll introduce appropriate A and CNAME DNS records to map to the VM where WMDP is installed. Please find detailed information about how to register A and CNAME DNS records for custom domain names for Microsoft Azure Cloud Services here: https://azure.microsoft.com/en-us/documentation/articles/cloud-services-custom-domain-name/

And then introduce appropriate A and CNAME records for alexwmdp.com domain as shown below

Record set properties (A)

Record set properties (CNAME)

Once set up the result will be the same. To make sure everything works great in addition to DNS record for demo.alexwmdp.com I actually created DNS record for handheld.alexwmdp.com in DNS zones via Microsoft Azure portal. Both URL’s would point to one place now: https://demo.alexaniwmdp.com/ , https://handheld.alexaniwmdp.com/

Then we’ll select ”Log on to the mobile device” and select the company

Selection of company

Finally, when company is selected we can sign in to AX

Sign in to AX (USMF)

Please note that you can now access WMDP from outside of the VM in a web browser via Internet.

Please also note that because I reused originally installed SSL certificate we will get Certificate warning when opening this URL which you can bypass and proceed with URL. To get rid of Certificate warning we can create a dedicated SSL Certificate registered for the custom domain name we introduced

At this point we can also conveniently access WMDP from the telephone using web browser. For example, this is how WMDP looks like on my Windows Phone

Phone - Microsoft Dynamics AX Warehouse Mobile Devices Portal

Phone – Select company

Phone – Sign in to AX

This is all great! But if for the purposes of your POC, demonstration or workshop you prefer to use WMDP simulator inside of New Microsoft Dynamics AX instead of full-fledged deployed WMDP, it is also a possibility. Let’s see how it works

Step 3: AX Simulation (Dynamics AX 2012 R3 and New Dynamics AX)

We are all familiar with WMDP simulator in Microsoft Dynamics AX 2012 R3

The simulation mode was accessible via WHSWorkExecute form and WHSWorkExecute action menu item

WHSWorkExecute menu item

WHSWorkExecute form

When launched you could use a native Microsoft Dynamics AX 2012 R3 form to simulate WMDP

Login

Menu

You could also add WHSWorkExecute menu item to the menu structure and keep it always available in your environment. For example, adding “Work process” menu item to Global tools menu

GlobalToolsMenu

Work process

At this point in New Microsoft Dynamics AX Work process menu item is not exposed by default

Find “Work process”

In fact, you can make it available the same way it was done in Microsoft Dynamics AX 2012 R3

At this point I would like to add “Work process” to expose WMDP simulator in Warehouse management menu. Let’s create a quick model for this purpose

Model

Then we’ll associate a new project to the model

New project

But before modifying Warehouse management menu we’ll find the way to launch Work process form in a web browser. The beautiful thing about New Microsoft Dynamics AX is that web pages are URL addressable which means that once authenticated we can launch required web pages by typing in URL in a web browser

Let’s quickly add WHSWorkExecute form to the project, make it a default Startup object and launch a web browser (by Starting the project) to find out about URL we need to use

Now coming back to menu modification we can add an extension for Warehouse management menu and expose “Work process” menu item via menu

Project

After we did a necessary modification in Visual Studio we can build the model to see the results reflected in New Microsoft Dynamics AX

Build model

And here’s the result

Warehouse management menu

Summary: In this article we discussed how to configure Warehouse Mobile Device Portal in New Microsoft Dynamics AX and quickly make it available on mobile devices for the purposes of POC (Proof of Concept), demonstration or workshop using Demo environment. Please note that this information may also help you better understand the process of configuring Warehouse Mobile Device Portal for Production purposes according to the official guidance described here: https://ax.help.dynamics.com/en/wiki/warehouse-mobile-devices-portal-for-microsoft-dynamics-ax/.

Note: This document is intended for information purposes only, presented as is with no warranties from the author. This document may be updated with more content to better outline the issues and describe the solutions.