Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi All,
I want to setup the Web Credentials for my Dataset by API from a service:
The Datasource is an Application Insights component. To do this manual, I have to use my organizational account.
But I want to do this automatically and for this I want to uses this API:
PATCH https://api.powerbi.com/v1.0/myorg/gateways/{gatewayId}/datasources/{datasourceId}
HI @megel,
You can try to use the following M query code if help with your scenario:
let
secretId = xxxxx,
authKey = "Basic " & secretId,
url = "https://api.xxxxx.com/oauth2/token",
GetJson =
Web.Contents(
url,
[
Headers = [
#"Authorization" = authKey,
#"Content-Type" = "application/x-www-form-urlencoded;charset=UTF-8"
],
Content = Text.ToBinary("grant_type=client_credentials")
]
),
token = Json.Document(GetJson)[access_token],
Result =
Web.Contents(
"https://xxxxx.xxx.com",
[
Headers = [
#"Content-Type" = "application/json",
Authorization = "Bearer " + token
],
RelativePath = "/xxxxx/xxxxx"
]
)
in
Result
Regards,
Xiaoxin Sheng
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |