Create an Application in Azure Portal

Create an application in Azure Portal

The next wave of IT revolution is all about cloud application development services. With close to 77% of the businesses opting for cloud application development or venturing into one form of cloud solution or the other, we felt it is ideal to publish a post on how you could develop your own application.

The platform we’ve chosen to give you a walkthrough is the Microsoft owned Azure. The cloud space is occupied by several market players such as Amazon, Microsoft and more and Azure is one of the leading solutions. So, let’s get started with Azure application development.

New Registration

  • Login on https://portal.azure.com/ using your credentials. Select Azure Active Directory and then App Registration.
  • Click on “New Registration”. Enter details as shown in the screen below and register the application.
Register an application

Generate Secret Key

  • To create secret key, select certificates & secrets.
  •  Click on New client secret.
  • Enter details as shown in the screen below and Add the client secret.
Generate Secret key

Copy the client secret value because this value will not be visible again. so, do not miss to copy this

API Permissions

  • To add permissions, click on API Permissions >> Add a permission
API Permission
  • Under this, select  Microsoft APIs and then Dynamics ERP.
  • Add all delegated and application permissions, click on Add permission. Permission will be added as shown in the screen below.
API Permission

Add Application in Dynamics 365 FO

  • Select System Administration and then go to Azure Active Directory applications and finally click on New
  • Enter Azure application client id in Application Id, application name and user id.
F&O Retail

Creating visual studio project for consuming OData service

Creating Odata Utility

1. Open Visual Studio.

2. Go to Tools >> Extension and Updates and find “OData v4 Client Code Generator”. If this is not installed, then install it from the same window.

3. Create a new C# project of type Class Library with the name “ODataUtilityTraining”. Add this project to a new solution with the name “ODataServicesTraining”.

ODataServices

4. Delete the default class (class1) that is created.

5. Right click on the project and click “New item”. In the Add New Item dialog, search for “OData Client”, which will be the class type. This will generate Proxy classes from the OData v4 service. The name of the class will be ODataClient.tt

6. When you get the following message box, click on Cancel.

Warning

7. Open ODataClient.tt file and find the code public const string MetadataDocumentUri = “”; and replace “” by your <D365FO URL>/data/$metadata 

8. Next, go to the code public const string TempFilePath = “”; and add here any temppath as below.

public const string TempFilePath = @”C:\DumpPathTraining\Edmx.xml”;

This path will be used to navigate to the “Edmx” xml file generated while processing the tt file.

Save the file and you will get the same message box (as step #5) again. Click on OK.

After the process is completed, verify if the .cs file generated is proper. Expand the .tt file and then the .cs file. You will see all the classes generated from the .tt file.

ODataClient

9. Right click on the project and click on Build.

Creating Authentication Utility

1. Create a new C# project of type Class Library with the name “AuthenticationUtilityTrainin”. Add this project to the existing “OdataUtilityServicesTraining” solution.

AuthenticationUtilityTrainin

2.  Install the following NuGet Packages:

  • Microsoft.IdentityModel.Clients.ActiveDirectory
  • Newtonsoft.Json
  • Microsoft.Odata.Client(this will automatically install a few more dependent packages)

Right click on the Project “AuthenticationUtilityTrainin” and select the option “Manage Nuget Packages”. So that below window will open.

In the “Installed” tab, verify that package is installed or not. If it is not installed then go to “Browse” tab and write the package name in “Search” window as shown in below screen.

NuGet Packages

Click on the “Install” button to install the package.

3. Follow the same steps to install other required packages also.

4. Delete the default class (class1) that is created.

5. Right click on the project and click on New Item. In the Add New Item dialog, select Code → Class and create a new class with the name ClientConfiguration.cs.

You can copy the code in this classe from Microsoft Dynamics AX Integration GitHub repository.

AX Integration

6. Right click on the project and click on New Item. In the Add New Item dialog, select Code → Class and create a new class with the name OAuthHelper.cs

7. Right click on the project and click on Build.

Creating the console application

1. Create a new C# project of type Console Application with the name “OdataConsoleApplicationTrain”. Add this project to the existing “OdataUtilityServicesTraining” solution.

OdataUtilityServicesTraining

2. Install the following NuGet Packages as shown in above steps:

  • Microsoft.IdentityModel.Clients.ActiveDirectory
  • Newtonsoft.Json
  • Microsoft.OData.Client (this will automatically install few more dependent packages)

3. Install the following reference from the solution:

Right click on the project. Add >> Reference

  • ODataUtilityTraining
  • AuthenticationUtilityTraining
Solution

4. Open the program.cs class generated in the console application and write the code in this class.

5. Right click on the project and click on “Build”.

6. Right click on “ODataConsoleApplicationTrain” and click on “Set as StartUp Project”.

7. Build the project and click on “Execute”.

Looking for Azure application development solution

Wrapping Up

The project will get initiated seamlessly. So, this is how you develop an application on Azure. We believe this was helpful.

The following two tabs change content below.

Leave a Reply

Your email address will not be published. Required fields are marked *