3
votes

I have been trying out the new PowerBI Embedded and I was sucessfully able to create a workspace collection, add some workspaces and then import my pbix and have it display. However I now want to clean up those workspaces and remove all of the sample reports and datasets. When I try and use the various "DeleteDataset" methods available on from Microsoft.PowerBI.Api nuget package.

If I try and delete a dataset using:

    var devToken = PowerBIToken.CreateDevToken(this.workspaceCollection, this.workspaceId);
using (var client = this.CreatePowerBIClient(devToken))
{
var delete_resp = client.Datasets.DeleteDatasetById(this.workspaceCollection, workspaceId, dsid);
}

By doing it this way I get an Unauthorized response. I also noticed that I can create a "ProvisionToken" so doing it this way:

var provToken = PowerBIToken.CreateProvisionToken(this.workspaceCollection);
using (var provClient = this.CreatePowerBIClient(provToken))
{
    var delete_resp = provClient.Datasets.DeleteDatasetById(this.workspaceCollection, workspaceId, dsid);
}

When I use the Provision token I get an internal server error.

I understand there is dependencies between datasets and reports however I do not see any methods available to delete reports first then clean up the datasets so I was hoping since I only saw delete data set methods it would remove the report as well. Has anyone run into these issues? Has anyone been able to successfully delete datasets and/or remove everything from a powerbi embedded workspace? I have been using the sample powerbi embedded app to test out these use cases.

1

1 Answers

2
votes

Deleting the datasets will also delete the reports that are connected to it. There is a bug in delete dataset that should be fixed sometime today.