diff --git a/bin/bitbake-getvar b/bin/bitbake-getvar
index 8901f99ae..20c0b696f 100755
--- a/bin/bitbake-getvar
+++ b/bin/bitbake-getvar
@@ -43,7 +43,9 @@ if __name__ == "__main__":
             d = tinfoil.parse_recipe(args.recipe)
         else:
             tinfoil.prepare(quiet=2, config_only=True)
-            d = tinfoil.config_data
+            # Expand keys and run anonymous functions to get identical result to
+            # "bitbake -e"
+            d = tinfoil.finalizeData()
 
         value = None
         if args.flag:
