Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
dinesh123
Helper II
Helper II

Embedded RLS

We are applying Embedded RLS in our power bi report however, there is a limitation of characters we can send from Username (limit 256 Characters). But need to pass more than 256 characters. Using Java SDK. 

1 REPLY 1
jaweher899
Super User
Super User

The limitation of 256 characters for usernames in Power BI Embedded RLS is a hard limit imposed by the service, and there is no way to increase this limit.

However, if you need to pass more than 256 characters in your usernames, you could consider using a hashing algorithm to generate a unique and shorter identifier for each user. You can then use this identifier instead of the full username in your RLS rules.

To generate the unique identifier, you can use a cryptographic hash function such as SHA-256 or MD5 to generate a hash of the user's full name or email address. The resulting hash value will be a fixed length and can be used as a key to identify the user in your RLS rules.

Here's an example Java code that shows how to generate a SHA-256 hash of a string:

 

import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class HashingExample {
public static void main(String[] args) throws NoSuchAlgorithmException {
String input = "user@example.com";
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(input.getBytes(StandardCharsets.UTF_8));
String hexHash = bytesToHex(hash);
System.out.println(hexHash); // use this value as the user identifier in your RLS rules
}

private static String bytesToHex(byte[] bytes) {
StringBuilder hex = new StringBuilder(2 * bytes.length);
for (byte b : bytes) {
hex.append(String.format("%02x", b));
}
return hex.toString();
}
}

 

This code generates a SHA-256 hash of the string "user@example.com" and prints the resulting hash value as a hexadecimal string. You can modify this code to generate hashes for your own user names or email addresses. Just make sure to use a secure and widely-used hash function and to keep the salt value consistent across all users.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors