Forum Discussion
How to combine data from many datasources with authentication
Hello, I've seen variations of this question on the forums, but not quite the same as my scenario. I want to gather data from REST API calls from multiple instances of the same software application (each instance is for a different tenant). I know how to use web.content, append and combine queries; my problem has to do with how to set up the data sources correctly. My API URLs look like this:
https://<user1>:<pass1>@<customer1>.myapp.com/api/object1
https://<user2>:<pass2>@<customer2>.myapp.com/api/object1
https://<user_n>:<pass_n>@<customer2>.myapp.com/api/object1
I want powerbi to connect to each customer environment 1 .. n and display a list of all object1 fields.
The problem I have is how to authenticate into many environments? I can write a function getObject1(username, password, url) but I get issues with authentication errors: "The 'Authorization' header is only supported when connecting anonymously. ". I think this has to do with data privacy and how powerbi stores data source credentials. it seems like authentication headers credentials can't be dynamically passed in.
So far, I've seen solutions to change authentication header "Authorization" to something else: "<Token>", which I can't do. I'm using 'regular' HTTP Basic authentication with Authorization = Binary.ToText(Text.ToBinary( username & ":" & password ), BinaryEncoding.Base64)
I was wondering if I could load all data sources into the powerbi file, and then write a loop to go through all configured data sources in the file. If I'm combining data from many objects, would I have to set up a data source for each URL variant or can I use the relative path in authentication header to get different objects?
https://<user1>:<pass1>@<customer1>.myapp.com/api/object1 | object2 | object 3
https://<user2>:<pass2>@<customer2>.myapp.com/api/object1 | object2 | object 3
https://<user_n>:<pass_n>@<customer2>.myapp.com/api/object1 | object2 | object 3
1 Reply
- v-joesh-msft
Solution Sage
Hi Anonymous ,
In my experience, the authentication headers credentials can't be dynamically passed in, if you want to combine data from many objects, you have to set up a data source for each URL variant.
Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.