Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I am currently trying to run the export to file in group rest api however I am getting the "needs effective identity" even though I am providing that. Can someone point to me as to what I am doing wrong?
https://learn.microsoft.com/en-us/rest/api/power-bi/reports/export-to-file-in-group#code-try-0
public string PBIInitialExportRequest(int customerID, Guid workspaceGUID, Guid datasetGUID, Guid reportGUID, string format)
{
try
{
//string baseUrl = $"{ConfigurationDataAccess.PBIConfigs.RestApiGroupUrl}/{ds.WorkspaceGUID}/datasets/{ds.DatasetGUID}/Default.BindToGateway";
string baseUrl = $"{ConfigurationDataAccess.PBIConfigs.RestApiGroupUrl}/{workspaceGUID}/reports/{reportGUID}/ExportTo";
//POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports/{reportId}/ExportTo
RestClient client = new RestClient(baseUrl);
RestRequest request = CreatePostRestRequest();
Guid gatewayObjectID = new Guid(ConfigurationDataAccess.PBIConfigs.AzureDatabricksGatewayObjectId);
List<Guid> datasourceObjectIds = new List<Guid> { new Guid(ConfigurationDataAccess.PBIConfigs.AzureDatabricksDataSourceObjectId) };
request.AddJsonBody(new
{
Format = format,
EffectiveIdentity = new
{
Username = customerID.ToString(),
Roles = new List<string> { "Company_User" },
Datasets = new List<string> { datasetGUID.ToString() }
},
datasourceObjectIds = datasourceObjectIds,
gatewayObjectID = gatewayObjectID
});
IRestResponse response = client.Execute(request);
if (response.IsSuccessful)
{
// Parse the response content to extract the id
var jsonResponse = JObject.Parse(response.Content);
string exportID = jsonResponse["id"].ToString();
//ApplicationLog.LogMessage($"Gateway assigned to dataset ({ds.DatasetName}) successfully. Export ID: {id}", LogName);
return exportID;
}
else
{
// The request failed
//ApplicationLog.LogMessage($"Failed to assign gateway to dataset ({ds.DatasetName}): {response.StatusCode}", LogName); ;
return null;
}
}
catch (Exception er)
{
return null;
}
}
Hi @Don-Bot ,
Just wanted to check if you had the opportunity to review the suggestion provided?
If the response has addressed your query, please accept it as a solution so other members can easily find it.
Thank You
Hi @Don-Bot ,
Just wanted to check if you had the opportunity to review the suggestion provided?
If the response has addressed your query, please accept it as a solution so other members can easily find it.
Thank You
Hi @Don-Bot ,
The " needs effective Identity" error typically means Power BI was not able to resolve the Effective Identity you're passing. Even though you're providing one, it's likely that one or more parts of it are incorrect or incomplete.
Here’s some steps you can follow how to fix them:
1. Check RLS - Make sure (RLS) is enabled on the dataset
If the dataset does not have RLS roles defined, Power BI will ignore the Effective Identity, and you'll get this error. Check that:
The dataset you're targeting has at least one RLS role (e.g., "Company User")
The user you're simulating (Username) is valid for that role
Go into Power BI Desktop → "Modeling" tab → "Manage Roles" → ensure "Company User" role exists.
2. Use the powerBIReportConfiguration Wrapper
The identities field should not be top-level. It should go inside the powerBIReportConfiguration object.
Wrap identities under powerBIReportConfiguration
3.Check the response body when the API fails. Even if response.IsSuccessful is false , the response.content might contain a message like : "The effective identity is invalid."
Log it for easier debugging.
Hope this helps!
If the response has addressed your query, please Accept it as a solution ' so other members can easily find it.
Thank You
User | Count |
---|---|
14 | |
6 | |
2 | |
2 | |
2 |
User | Count |
---|---|
3 | |
3 | |
3 | |
2 | |
2 |