class AzureVirtualMachineService {

    @Retryable(backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000), maxAttempts = 5)
    public Map<String, VirtualMachine> getVirtualMachinesByName(AzureClient azureClient, String resourceGroup, Collection<String> privateInstanceIds) {
        LOGGER.debug("Starting to retrieve vm metadata from Azure for ids: {}", privateInstanceIds);
        PagedList<VirtualMachine> virtualMachines = azureClient.getVirtualMachines(resourceGroup);
        while (hasMissingVm(virtualMachines, privateInstanceIds) && virtualMachines.hasNextPage()) {
            virtualMachines.loadNextPage();
        }
        validateResponse(virtualMachines, privateInstanceIds);
        return collectVirtualMachinesByName(privateInstanceIds, virtualMachines);
    }

}