There are some scripts in GitHub that you can use for Power BI: https://github.com/DevScope/powerbi-powershell-modules. In GitHub, you will find modules for REST APIs and for connecting Power BI Desktop to SQL Server.
Another script that you will probably use is this script taken from https://docs.microsoft.com/en-us/power-bi/service-admin-auditing. This script allows you to access and search audit logs: