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

Special holiday offer! You and a friend can attend FabCon with a BOGO code. Supplies are limited. Register now.

Reply
kjetil_hamre
Frequent Visitor

setting onelake security column level security programmatically

Hi,

I am very keen to see Onelake security in production. However, I would like to set column level security programmatically in a metadata driven setup of ingest into a medallion architecture. 

 

I hear that the fabric rest api is the most mature programming interface. However I cannot see anything documented on onelake security. Indeed, when I set schema enabled on a lakehouse, I cannot even list tables.

import requests
token_string = mssparkutils.credentials.getToken(https://api.fabric.microsoft.com/)
header = {'Content-Type':'application/json','Authorization': f'Bearer {token_string}'}
response = requests.get(url=https://api.fabric.microsoft.com/v1/workspaces/{WORKSPACE_ID}/lakehouses/{LAKEHOUSE_ID}/tables, headers=header)

print("Status Code:", response.status_code)
print("Response JSON:", response.json())

------
Status Code: 400
Response JSON: Response JSON: {'requestId': 'blablah', 'errorCode': 'UnsupportedOperationForSchemasEnabledLakehouse', 'message': 'The operation is not supported for Lakehouse with schemas enabled.'}

And I find no mention of any attributes regarding onelake security! Anybody has any information on if there is something available now, or if there is going to be something on this soon? Or if there is some other way of setting these things programmatically. 

Thank you
K

1 ACCEPTED SOLUTION
tayloramy
Community Champion
Community Champion

Hi @kjetil_hamre

 

Welcome to the fun of preview features - don't try and push this into production until it becomes GA. 

 

This is interesting, the error message you are getting states that lakehouses with schemas (also in preview and should not be in use in production) aren't supported, but the documentation seems to say otherwise: 

https://learn.microsoft.com/en-us/rest/api/fabric/core/onelake-data-access-security/create-or-update...

 

 

Are you able to do this via the UI at all? 
https://learn.microsoft.com/en-us/fabric/onelake/security/get-started-onelake-security

If you can, there might be a bug with the API. 

 

 If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.

View solution in original post

2 REPLIES 2
kjetil_hamre
Frequent Visitor

The first link is to the documentation I was looking for! Thank you. I am now able to set column level security on specific columns in the lakehouse. Just what I was looking for. As for the schema enabled lakehouse there might be a bug, but otherwise it works. Thanks!!!

regards,
Kjetil

tayloramy
Community Champion
Community Champion

Hi @kjetil_hamre

 

Welcome to the fun of preview features - don't try and push this into production until it becomes GA. 

 

This is interesting, the error message you are getting states that lakehouses with schemas (also in preview and should not be in use in production) aren't supported, but the documentation seems to say otherwise: 

https://learn.microsoft.com/en-us/rest/api/fabric/core/onelake-data-access-security/create-or-update...

 

 

Are you able to do this via the UI at all? 
https://learn.microsoft.com/en-us/fabric/onelake/security/get-started-onelake-security

If you can, there might be a bug with the API. 

 

 If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.

Helpful resources

Announcements
December Fabric Update Carousel

Fabric Monthly Update - December 2025

Check out the December 2025 Fabric Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors