Download file by ID and linked to PowerBI

Hi, all.

I'm trying to develop a script to download a file by its ID.


My scenario involves using Power BI, and I need to set up a data source linked to the document.
So I’ve thought of two approaches for this, and I’m trying to apply them in a cloud vault environment:

I've already tried both approaches, but I'm getting errors in each case.
Maybe there's a similar solution for this situation. Could you help?