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.
- 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.
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.
Copy the client secret value because this value will not be visible again. so, do not miss to copy this
- To add permissions, click on API Permissions >> Add a 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.
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.
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”.
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.
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.
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.
2. Install the following NuGet Packages:
- 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.
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.
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.
2. Install the following NuGet Packages as shown in above steps:
- 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
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
The project will get initiated seamlessly. So, this is how you develop an application on Azure. We believe this was helpful.
Latest posts by devitblogs (see all)
- A Beginner’s Guide To Using Amazon S3 Storage Classes and Their Purpose - September 20, 2021
- Custom Authentication with Azure API Gateway - September 20, 2021
- The Fundamentals of Kotlin Coroutines Every Developer Should Know - September 20, 2021