Tag: Online Management API

Online Management API: Using Console Application

Once you have set up the App Permissions for Azure AD to access Dynamics CRM Online you can use the Application ID to authenticate with Online Management API and work with Various Operations.

 

Follow the given steps to understand how to set up Console Application to work with Online Management API:

  • Open Visual Studio and Create a new “Console Application”
  • Create a New Class file called “Helper.cs” and copy the helper code (from SDK) to the file.

 

  • In Helper code update client id to your Application ID while you registered CRM Online App with Azure AD. Set URL to “http://localhost/” 
  • Add Reference to “Microsoft.IdentityModel.Clients.ActiveDirectory”. If you don’t have it installed you can install it through NuGet Package
    • Right click the References -> Click Manage NuGet Packages.
  •  
    • Search for “Microsoft.IdentityModel.Clients.ActiveDirectory” and select version “2.x.x” as version “3.x.x” will not work.  Click Install.
  •  
  • Replace Program class with following code (taken from SDK Sample) and add missing references.

 

  • Update the Service URL based on your region.
  • Run the Application, it will ask for Online Authentication and approval to give permissions to app.
  • Once executed you will get instance information.

For Sample Highlighted above you can refer to First Sample solution in following Git Repo.

https://github.com/BuggyBrain/Dynamics.OnlineManagement   

Online Management API: Setting up Access through Azure AD

To access Online Management API first thing we need to do is register Dynamics CRM app with Azure AD so that our console application can have access to it.

 

To register App with Azure AD:

  • Navigate to Azure Portal. (Even if you are using trial account it will work).
  • Go to Azure Active Directory -> “App registration”

  • Click “New Application Registration”

  • Key in the Details

 

  • Once App is Created you can see app details.  Application ID is the Client ID we require for the app authentication, Keep Application ID with you for authenticating through Client App.

  • To provide this app permission to Dynamics CRM Online Management API click on Required Permissions -> Add -> Select an API

 

  • Select Dynamics CRM Online from list

 

  • Once “Dynamics CRM Online” is selected, click “Select Permissions” -> “Access CRM Online Organization users” -> “Select”.

 

 

After following above steps you will be able to Authenticate from your custom native app to Online Management API.

Online Management API : Introduction

Microsoft recently released Online Management API for Dynamics 365 Customer Engagement (CRM) instances.

This can be used to automate the process for which we typically required Office 365 Global Admin to Log in to Admin Center and manually slog.

With help of this now we can now go ahead and fulfill our ALM and CI dreams right from setting up a new instance (and going ahead with deploying solutions to those instances using Dynamics CRM metadata calls).

 

Certain key processes which can be automated through Online Management API are:

  • Creating a new Dynamics 365 Instance
  • Retrieving Instance as well as Information about instances
  • Deleting an Instance
  • Taking a Backup (of instance)
  • Retrieving Backup
  • Restoring Backup
  • Retrieving the Templates i.e. Sales, Customer Service, Field Service etc…
  • Retrieve Currency, Languages supported by Instance.
  • Retrieve operation statuses (which have been Triggered)
  • Update Admin Mode setting of instance so that its not available to users.

 

Along with above Online management api can also be used to manage server to server authentication by supporting:

  • Creations of Tenant Application Identity
  • Retrieval of Tenant Application Identity
  • Enable or Disable Tenant Application Identity.

 

Key points to note for API:

 

In my next blog posts I will cover: