Forum Discussion
Help with Editing Data Source Credentials in PowerShell for Power BI Embedded Dashboards in D365 CRM
- 1 year ago
Hi,
Thanks so much for all your help and suggestions. After trying the different recommendations, we followed these steps, and it resolved the issue:
$body = @{
"credentialDetails" = @{
"credentialType" = "OAuth2"
"encryptedConnection" = "Encrypted"
"encryptionAlgorithm" = "None"
"privacyLevel" = "Organizational"
"useCallerAADIdentity" = $true
}
}
# Convert the body to JSON format
$jsonBody = $body | ConvertTo-Json -Depth 5
Invoke-PowerBIRestMethod -Url "https://api.powerbi.com/v1.0/myorg/gateways/$($datasource.GatewayId)/datasources/$($datasource.DatasourceId)" -Method PATCH -Body $jsonBody
I appreciate the time you all took to assist me.
Thanks!
Hi SamInogic ,
Could you please provide the following info for the further troubleshooting?
- Whether the access token $accesstoken is being retrieved correctly and is valid?
-
Whether the gateway and data source IDs used in the endpoint URL are correct and accessible within the new tenant?
-
Whether the account you are using has the necessary permissions for updating data source credential?
|
# Connect to the Power BI Service # Get Access Token # Construct the request body # Convert the request body to JSON # API Endpoint (replace with your specific gateway and data source ID) # Send the PATCH request |
Best Regards