Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 17878

Update SSAS Live dataset connection via Power BI API

$
0
0

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;
}

 


Viewing all articles
Browse latest Browse all 17878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>