Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
After publishing a report(SSAS Live) to the service, I am trying to access the report from my app and update the connection string using the code below but I always get an error "Operation returned an invalid code, "BadRequest"". The SetAllDatasetConnectionsInGroup worked fine for all DirectQuery reports we had. We are trying to switch over to SSAS for better performance.
P.S. I am trying to use the CustomData property of the SSAS connectionString to pass in the custom value for RLS
Snippet
try { if (!string.IsNullOrEmpty(connectionString)) { var connectionDetails = new ConnectionDetails() { ConnectionString = connectionString }; var powerBiClient = await _client.GetPowerBiClient(); var response = powerBiClient.Datasets.SetAllDatasetConnectionsInGroup(groupId, datasetId, connectionDetails); LogHelper.LogInfo(string.Format("Dataset {0} in workspace {1} update with connection string {2}", datasetId, groupId, connectionString)); return TaskStatus.Completed; } else { LogHelper.LogError("Connection String cannot be null or empty"); return TaskStatus.Failed; } } catch (Exception ex) { LogHelper.LogError(ex); return TaskStatus.Failed; }
Solved! Go to Solution.
@Anonymous wrote:
Hi All,
After publishing a report(SSAS Live) to the service, I am trying to access the report from my app and update the connection string using the code below but I always get an error "Operation returned an invalid code, "BadRequest"". The SetAllDatasetConnectionsInGroup worked fine for all DirectQuery reports we had. We are trying to switch over to SSAS for better performance.
P.S. I am trying to use the CustomData property of the SSAS connectionString to pass in the custom value for RLS
Snippet
try { if (!string.IsNullOrEmpty(connectionString)) { var connectionDetails = new ConnectionDetails() { ConnectionString = connectionString }; var powerBiClient = await _client.GetPowerBiClient(); var response = powerBiClient.Datasets.SetAllDatasetConnectionsInGroup(groupId, datasetId, connectionDetails); LogHelper.LogInfo(string.Format("Dataset {0} in workspace {1} update with connection string {2}", datasetId, groupId, connectionString)); return TaskStatus.Completed; } else { LogHelper.LogError("Connection String cannot be null or empty"); return TaskStatus.Failed; } } catch (Exception ex) { LogHelper.LogError(ex); return TaskStatus.Failed; }
@Anonymous
AFAIK, it is a limitation. The underlying REST API Set All Connections only supports DirectQuery datasource, the SSAS live connection is not treated as DQ mode anyhow.
@Anonymous wrote:
Hi All,
After publishing a report(SSAS Live) to the service, I am trying to access the report from my app and update the connection string using the code below but I always get an error "Operation returned an invalid code, "BadRequest"". The SetAllDatasetConnectionsInGroup worked fine for all DirectQuery reports we had. We are trying to switch over to SSAS for better performance.
P.S. I am trying to use the CustomData property of the SSAS connectionString to pass in the custom value for RLS
Snippet
try { if (!string.IsNullOrEmpty(connectionString)) { var connectionDetails = new ConnectionDetails() { ConnectionString = connectionString }; var powerBiClient = await _client.GetPowerBiClient(); var response = powerBiClient.Datasets.SetAllDatasetConnectionsInGroup(groupId, datasetId, connectionDetails); LogHelper.LogInfo(string.Format("Dataset {0} in workspace {1} update with connection string {2}", datasetId, groupId, connectionString)); return TaskStatus.Completed; } else { LogHelper.LogError("Connection String cannot be null or empty"); return TaskStatus.Failed; } } catch (Exception ex) { LogHelper.LogError(ex); return TaskStatus.Failed; }
@Anonymous
AFAIK, it is a limitation. The underlying REST API Set All Connections only supports DirectQuery datasource, the SSAS live connection is not treated as DQ mode anyhow.
I really hope this is not the case...
You cannot update dataset connection string if you have a SSAS live connection report. We are struggling maintaining model per client.. its crazy!
I have approximately 5000 individual reports, each with a specific connection string. We need to change them to imported mode. I can change the connection string while they are using direct query. But they are sluggish as hell unless we change them to imported mode.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
3 |