Forum Discussion
All models within a workspace using the same credentials
- 1 year ago
I think I found a solution. I dont like the fact I have to make credentials visible in the code but it works in PBID and the app service.
let // Your username and password Username = BasicAuthUsername, Password = BasicAuthPassword, // Encode the credentials Credentials = Binary.ToText(Text.ToBinary(Username & ":" & Password), BinaryEncoding.Base64), // URL of the web source SourceUrl = "https://www.example.co.uk", // Retrieve the data with authorization header Source = Json.Document( Web.Contents(SourceUrl, [ Headers = [Authorization = "Basic " & Credentials] ]) ), // Retrieve the data with authorization header Records = Source[Records],
Hi. Unless you can get all the data with a single credential and then filter by customer at Power Query, I don't think you can make it with "just PowerBi". Like you are saying, Power Bi stores data sources in order to make it easy for refreshes and developers. If you have a data source with an address and type, it stores the credential for that specific one to replicate it each time you use it.
You might need to add another layer to your proyect. Like a database, datalake or warehouse. That can help you storing the data from an ETL or code tool that can get the data from the API. For example, writing a notebook that runs the api for each credential and the stores it on the storage. After that you could connect Power Bi.
I hope that helps,