Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am trying to create a new data source on a gateway using the .NET SDK, but every call results in bad request due to a PowerBIEntityFrameworkOperationException.
I've tried to follow the instructions on https://docs.microsoft.com/en-us/power-bi/developer/automation/configure-credentials?tabs=sdk3#confi...
but I may have missed something.
string oleConnectionString = "{\"connectionString\":\"provider=SQLOLEDB.1;initial catalog=my database;data source=my server;ApplicationIntent=ReadOnly\"}";
var credentialsEncryptor = new AsymmetricKeyEncryptor(gateway.PublicKey);
var credentials = new BasicCredentials("my username", "my password");
var credentialDetails = new CredentialDetails(credentials, PrivacyLevel.Organizational, EncryptedConnection.Encrypted, credentialsEncryptor);
var oleRequest = new PublishDatasourceToGatewayRequest("OleDb", oleConnectionString, credentialDetails, "New data source");
var newDatasource = await pbi.Gateways.CreateDatasourceAsync(gateway.Id, oleRequest);
Things I've tried:
1. Creating the data source manually in the Power BI portal. This works.
2. My data source is SQL Server but I need to pass parameters in the connection string so I'm using the OleDB provider. As a test I've tried change the data source type to "SQL" and the connection details to
I'm receiving the same error. Also trying it in the sandbox (https://docs.microsoft.com/en-us/rest/api/power-bi/gateways/createdatasource) returns the same error.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
2 | |
2 | |
1 | |
1 |