After upgrading vRealize Business for Cloud, cost calculation might fail.


Occasionally, cost calculation for Azure endpoints might fail after vRealize Business for Cloud is upgraded. You might see the Multiple entries with same key error message in the server log.


This problem appears because of duplicate entries created in the FactsRepo inventory service after the upgrade.


  1. Log in to the vRealize Business for Cloud, using the system administrator credentials.
  2. Start the Postgres client by entering the following command.


  3. Enter the following command in the Postgres client.

    delete from itfm_azure_resource_details where id in (select from (select resource_id, month, count(*) from itfm_azure_resource_details group by resource_id, month having count(*)>1 ) as new_details inner join itfm_azure_resource_details on itfm_azure_resource_details.resource_id=new_details.resource_id and itfm_azure_resource_details.month=new_details.month);

  4. Exit the Postgres client by entering the following command.


  5. Log in to MongoDB by entering the following command.


  6. Enter the following command.

    use fr_system

  7. To get the duplicates from the azure resource collection, enter the following query.

    db.getCollection('azureResource').aggregate([{$group: { _id: { resourceId:"$resourceId" }, count: { $sum: 1 } }},{$match : {count: {$gte :2}}}]);

  8. Copy the output to a text file.

    The output contains resourceId and count information in two columns.

  9. Remove each duplicated entry individually by entering the following command once for each entry.


    You must replace <resourceIdFromQuery> with resourceId for each entry from the output you have copied to the text file.

  10. To exit MongoDB, press the following key combinations.