Embed PowerBI reports is one way to distribute reports to the clients without exposing the filters and able to control how the client views the reports based on their roles. The data can be further restricted using Row Level Security. The sample codes for python are available here.
The different access levels and the details of the payload to be sent for the embed request can be found here.
The below code in python can be used to create the payload
payloaddict = {
“accessLevel” : “View”,
“identities” : [],
}
datasetArr = [ datasetid ]
identitydict = {
“username” : userid,
“roles” : role,
“datasets” : datasetArr,
}
payloaddict[‘identities’].append(identitydict)
payload = json.dumps(payloaddict)
After the token has been created, it can be tested in the playground provided by Microsoft.