Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi, I query my API to get data. Below is an example of the query I use to generate access token
let
url = "https://xyz.com/api/auth-service/token",
body = "{ ""grant_type"": ""password"", ""username"": ""api-user"", ""password"": ""word12345""}",
tokenResponse = Json.Document(Web.Contents(url,[Headers = [#"Content-Type"="application/json"], Content = Text.ToBinary(body) ] )),
AccessToken = tokenResponse[access_token],
url1 = "https://xyz.com/api/reporting/",
Source = Json.Document(Web.Contents(url1,[Timeout=#duration(0,0,120,0),Headers=[#"Authorization"="Bearer "&AccessToken,#"Content-Type"="application/json"]]))
in
Source
I want a way where I don't display my username and password in the API Body. I don't want any user downloading the report to view my username and password that I have used in the API Body. is there a way to hide my username and password from the body so that only I could view the same.
My main objective is that ,I don't want any user who downloads my PBIX to view the username and password that I have used in the Body of my POST request.
What would be the right way to get this done is there any alternate way i can follow.
If any more details is required for the requirement ,please let me know.
Thanks
@rubayatyasmin can you guide me on how i can use Azure Key Vault to get my issue resolved, I don't have much idea on the process
Sure.
Set up Azure Key Vault:
Store the credentials in Azure Key Vault:
Grant access to the Key Vault:
Update your Power BI dataflow:
for example,
let
// Azure Key Vault URL
keyVaultUrl = "https://YOUR_KEY_VAULT_NAME.vault.azure.net/",
// Secret names
usernameSecretName = "YOUR_USERNAME_SECRET_NAME",
passwordSecretName = "YOUR_PASSWORD_SECRET_NAME",
// Retrieve the credentials from Azure Key Vault
username = SecretValue(keyVaultUrl & "secrets/" & usernameSecretName & "/?api-version=7.1").value,
password = SecretValue(keyVaultUrl & "secrets/" & passwordSecretName & "/?api-version=7.1").value,
// Use the credentials in your API request
url = "https://xyz.com/api/reporting/",
Source = Json.Document(Web.Contents(url, [Timeout = #duration(0,0,120,0), Headers = [#"Authorization"="Basic " & Text.ToBinary(username & ":" & password), #"Content-Type"="application/json"]])),
in
Source
Replace the following placeholders with the appropriate values:
In this example, the SecretValue function is used to retrieve the values of the secrets from Azure Key Vault. The credentials are then used in the API request headers, such as the "Authorization" header.
here is a similar tutorial. that should be helpful.
if my assistance helped you in any way, hit 👍.
Proud to be a Super User!
Hi, @Camel
Here are some ideas:-
Power BI Dataflows: Use Dataflows to connect to the API. This lets you control data access separately, but credentials can still be viewed by users with Dataflow access.
Azure Key Vault: Safest option if you're using Azure. It's designed for securely storing and accessing secrets.
If 1,2 is not an option then you can take the username and password as an on-prem file. So, if someone accesses it they won't see it.
Also, there is a similar thread that might be of help.
if my assistance helped you in any way, hit 👍.
Proud to be a Super User!