Sunday, 1 October 2017

First look at Azure Functions

Azure Functions allows you to write code that can be triggered by an event or timer. You don’t need a machine to run it on. All the computing runs on the Azure cloud ie sevrverless computing.

Below is a quick walk through. Keep in mind Microsoft has great documentation on their site. Just google it.

In this post I will put a simple walkthrough. Save you from the information overload.


Make sure you are using Visual Studio 2017.

Create a project of type “Azure Function”

image

Give it a minute to resolve the NuGet package. You will see a warning icon and watch it disappear by it self.

image

Once its done. Right click and Add item.

Select the type of function. The easiest to do is the Http trigger.

image

This will create a class with some sample code.

image

When you run it, it will run a local instance.

image

Navigate to the URL and watch it run.

image

There are many applications in the Dynamics space. Hopefully next time I can cover some Dynamics scenarios.

Monday, 25 September 2017

Technical dive into the Mobile Platform in Update 10

With the recent Platform update 10 they introduced server side coding and made some enhancements to the mobile platform. This brings a lot of flexibility and capabilities. Below I will focus on just the Expense Management Mobile workspace.

For one, the Mobile workspaces are now embedded in the AOT as a resource file. Notice how it says “In metadata”. This indicates that it has loaded from the AOT. I think this is a good move. Its all about ALM. This is also great to keep the server side and client side in sync.

image

The nice thing is that the Expense Mobile solution is in its own model. Makes it easy for us to track and learn from.

The main entry is the workspace resource file xml. Notice the guid, this is important for doing some server side coding.

image

Now lets take a look at the workspace class. You will notice the same guid is used for the class attribute.

image

in one of my prior posts, I mentioned that the currency field wasn’t being defaulted when entering a new expense. Now with server side coding you can achieve some of these things.

Below is a default config contract class. It is triggered from the above class. You can add as many contract classes as you like. See line 20 and 21 in the above screenshot.

image

If you look at the js file embedded in the workspace xml. You will notice that it loads the config contract onto the client side. Allowing it to work client side and not requiring a connection to the server.

image

The other things you will notice is that there are a number of forms created just for the mobile solution. Below are screenshots of the whole model. Its not that big but there has been substantial work done to get to this point.

Below are some screenshot for my own reference. I know I will refer to to it in the future.

image

image

image

image

Refer to Mobile Platform landing page for more information.

https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/mobile-apps/platform/mobile-platform-home-page

Friday, 8 September 2017

Azure AD Authentication for Windows Applications

In this post I will describe how you can get the login dialog to pop up when you are developing a windows desktop application.

Below is an example of the dialog appearing.

image

Below is a sample code how to acquire the token.

string authorityUri = "https://login.windows.net/common/oauth2/authorize";
Uri redirectURI = new Uri("https://login.live.com/oauth20_desktop.srf");                

AuthenticationContext authenticationContext = new AuthenticationContext(authorityUri);

AuthenticationResult authenticationResult = authenticationContext.AcquireTokenAsync(
   ClientConfig.Default.ActiveDirectoryResource, 
   ClientConfig.Default.ActiveDirectoryClientAppId, 
   redirectURI, 
   new PlatformParameters(PromptBehavior.RefreshSession)).Result;

Add the redirect URI for https://login.live.com/oauth20_desktop.srf

image


Reference: https://docs.microsoft.com/en-us/rest/api/datacatalog/authenticate-a-client-app

Thursday, 31 August 2017

Table casting in AX 2012 and D365O

D365O is a lot more sensitive about casting or should I say AX2012 was too relaxed about it. This post is to show a specific scenario that works differently in the new version of the product.

We had a bit of code that worked fine in AX2012 but stopped working in D365O. After debugging we found that when you cast a table it took the tableId of the cast.

Below is an example of AX2012 vs D365O:

image

image

UPDATE – Thanks for Joris for pointing this out.

Same code running in CIL in AX2012. The piece of code in question was running client side. Otherwise, I would have noticed this in AX2012 too.

image

Wednesday, 23 August 2017

Daxeam Mobile Solution Released on Apple App Store and Google Play Store

I am very happy to say Daxeam Mobile is now available on Apple App store and Google Play Store. Daxeam Mobile fully working on both Dynamics 2012 and Dynamics 365 for Finance and Operations, Enterprise Edition.

imageimage

Daxeam is an Enterprise Asset Management (EAM) solution available exclusively for Microsoft Dynamics AX 2012 and Dynamics 365 for Finance and Operations, Enterprise Edition. The Daxeam solution extends the functionality of AX, delivering integration to EAM across Projects, Inventory, Finance and Fixed Assets.

Some key items to note about the Mobile solution:

  • Daxeam Mobile is an application built from the ground up to work with the Daxeam
  • Login is managed security via Azure Active Directory
  • Works for both AX2012 and D365O
  • Offline capable – has sophisticated sync capabilities to download your data locally and syncs back up when connection is available
  • Features available
    • Asset hierarchy
    • Asset management such as meter updates, view attributes, structures and related history
    • Work order management such as creating, editing, status updates, registering hours, registering items, executing your checks and many more
    • Observation management such as creating, editing
    • Taking pictures
    • Searching and Barcode scanning

image

Saturday, 15 July 2017

Hybrid connection - Web Api App for AX 2012 to Azure-part 4

This is the final post of this series.

Web Api App for AX 2012 to Azure–Intro
Deploy a Web Api App for AX 2012 to Azure–part 1
Application settings - Web Api App for AX 2012 to Azure-part 2
Authentication - Web Api App for AX 2012 to Azure-part 3
Hybrid connection - Web Api App for AX 2012 to Azure-part 4 (this one)


In this post we will set up a Hybrid Connection. This is basically a listener that sits on your on-premise server. It will expose internal port to Azure. More information on Hybrid connection on Microsoft’s site.

https://docs.microsoft.com/en-us/azure/biztalk-services/integration-hybrid-connection-overview

In your Api App, click on Networking. Then click on “Configure your hybrid connection endpoints”.

image

First download the connection manager. Install this on your on-premise server that you want to install the listener.

You don’t have to run the connection manager just yet. Set up the hybrid connection by clicking on the “Add hybrid connection”

image

Click on the “Create new hybrid connection”

image

Enter the required detail. Host is the AOS server name. The port is the net tcp port number.

image

If unsure what port to enter. Have a look at the net.tcp address in the wsdl or inside the web config file.

SNAGHTML1be4f1aa


Now lets run the Hybrid connection Manager you installed a few steps earlier. Click on “Configure another Hybrid Connection”. It will ask you to log in. Once logged in, you can seelect an existing connection. This is what you created in the portal. Click on Save and you should see a green “Connected” status next to it. The web portal should show the same.

image

That is it. Give it a test by navigating to the swagger URL. The URL is just the Api App url suffixed with swagger. eg.

https://axaptaapi1.azurewebsites.net/swagger

Authentication - Web Api App for AX 2012 to Azure-part 3

Lets set up the authentication in this post. You should always secure your application and never leave it exposed out to the web.

Click on Authentication menu and turn it on. In the drop down, select Azure Active Directory. In the Authentication providers click on Azure Active Directory to start configuring it.

image

Select the Express mode. This will create an web App registration.

image

Once authentication is configured. Lets set up a native Application registration. This step is only required if you are trying to communicate to the web service via a desktop applications, mobile application, third party tools to access your web services.

More information on application permissions and authentication on the Microsoft article.

https://docs.microsoft.com/en-au/azure/active-directory/develop/active-directory-authentication-scenarios

Navigate the the Active directory menu and click on Application permissions. You will see the “Web app/API” application registration. We will create a Native application registration.

image

When creating it you will be asked to enter a redirect URI. Enter a valid uri.

image

Click on the Native application registration and click on Required permissions. Add the Web App registration and Grant permissions (button at the top).

image

When you are adding it. You will have to search for it. It wont show up on the list automatically.

image

We are done.


Now lets test it by navigating to the swagger url. You will be asked to log in and also accept permissions.

image

There is a test service you can run to check that it has recognised you.

image