The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
let
#"HR-On employees" = let
// Parametre
client_id = "xxx",
client_secret = "yyy",
api_url = "url",
token_url = "token",
// Obtain Authorization Credentials
ObtainAuthorizationCredentials = Json.Document(
Web.Contents(token_url,
[
Content = Text.ToBinary("grant_type=client_credentials&client_id=" & client_id & "&client_secret=" & client_secret),
Headers = [#"Content-Type" = "application/x-www-form-urlencoded"]
]
)
),
refresh_token = ObtainAuthorizationCredentials[refresh_token],
access_token = ObtainAuthorizationCredentials[access_token],
// Brug token til at hente data
Kilde = Json.Document(
Web.Contents(
api_url,
[
Headers = [Authorization = "Bearer " & access_token]
]
)
),
items = Kilde[items]
in
Kilde,
items = #"HR-On employees"[items],
#"Konverteret til tabel" = Table.FromList(items, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Udvidet Column1" = Table.ExpandRecordColumn(#"Konverteret til tabel", "Column1", {"id", "companyAdmin", "leader", "systemUser", "archived", "picture", "systemFields", "customFields", "departments", "roles", "createdAt", "updatedAt", "customId"}, {"id", "companyAdmin", "leader", "systemUser", "archived", "picture", "systemFields", "customFields", "departments", "roles", "createdAt", "updatedAt", "customId"})
in
#"Udvidet Column1"
When I run my script in power bi desktop, everything is fine, and no prompt for credentials, since everything is handled in the script.
But when I upload to Power BI it prompts for credentials and they are not needed. I have tried anonymous, my own etc. but it errors.
What might be the error?
Solved! Go to Solution.
Just don't test the connection and everything is fine
Just don't test the connection and everything is fine