A virtual entity is a custom entity in Dynamics 365 that has fields containing data from an external data source. Virtual entities appear in Dynamics 365 to users as regular Dynamics 365 entity records, but contain data that is sourced from an external database, such as an Azure SQL Database. Records based on virtual entities are available in all Dynamics 365 clients including custom clients developed using the Dynamics 365 Customer Engagement Web Services.
Steps to configure:
1) Configure CRM based on available Odata webAPI. For this step, there is one Odata API Available over the net. http://services.odata.org/V4/OData/OData.svc/
To start with, you first need to create Virtual Entity Data source. Direction setting ->Administration->Virtual Entity Administration

Post this configuration, you need to create virtual entity with below configurations.

Steps require to create virtual entity
a) Mark check box virtual entity.
b) Select the Data source which is created in above steps.
c) There is a field know as External Name and External Collection Name. So we are implementing for Entity Advertisement. If you browse API, You will see collection name as Advertisements and external name as Advertisement.


If you can see the above snapshot, Entity know as Person has a id of type as Int which will not be able to sync with CRM as CRM only understands the Id of type Guid(visible in Entity Advertisement).
d) Next process is to Create fields and map to the fields specified in API.
There are two out of Box field Id and Name which you can directly map to ID and Name of API(Copy from API Metadata)
For Field AirDate, we can create one more field of type Date and Time and map to AirDate field of API.(Refer to below snapshot.)

Once publish, the above entity view come like below.

Some of the drawback of virtual entity are:
a) Entity are organization Owned. So no Security Role can be played.
b) Only privileges you have is to Reads, Append and Append to.
c) So as the form is in read Only mode – No update or delete of record can perform.
2) To Create OData Api, you can follow the step by step process of below given URI
http://www.c-sharpcorner.com/article/virtual-entity-new-way-of-integration-part-22/
It also contains source code, which you can download to refer.
Things to remember:
a) The Api need to be deployed, on Azure. As Dynamics 365 doesn’t understand Localhost Api.
b) You need to install Odata dll in the API, as the application doesn’t come with prepackage dll.
Just go to Tool ->Nuget pakage manager and run below command: Install-Package Microsoft.AspNet.OData
c) Do add the OData v4 scaffolding over the API as CRM doesn’t understand the version V2. To do that Go Tools ->Extension and Updates->Install Odata v4 Scaffolding.
Thanks.