Databricks grant update calatog catlog_name --json @privileges.json not updating privileges
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 08:30 AM
Hi Team,
I am trying to update the catalog permission privileges using databricks cli command Grant by appending json file but which is not updating the prIviliges, please help on grant update command usage.
Command using : databricks grants update catalog demo_cat --json @privileges.json
which is listing old prIviliges only, not updating i have updated from ALL_PRIVILEGES to USE_CATALOG
privileges.json content:
{
"privilege_assignments": [
{
"principal":"mailid",
"privileges": [
"USE_CATALOG"
]
}
]
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 12:37 PM - edited 06-07-2024 12:38 PM
Hello @Prasad_Koneru
If the command is not updating the privileges as expected, there could be a few reasons for this.
Firstly, ensure that the JSON file is correctly formatted and contains the correct privilege assignments. The privileges.json file should look something like this:
{
"privilege_assignments": [
{
"principal": "principal_name",
"privileges": [
"USE_CATALOG"
]
}
]
}
Replace "principal_name" with the actual principal (user or group) to which you want to grant the privilege.
Secondly, make sure that you have the necessary permissions to update the privileges. If you don't have the required permissions, the command might not execute as expected.
Lastly, there could be an issue with the Databricks CLI itself. Ensure that you're using the latest version of the CLI and that it's correctly configured.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 07:49 AM
Hi,
I am having a similar issue when trying to update grants for my external location and trying to grant all privileges to "ml" service principal.
Running on Windows with version Databricks CLI v0.223.1
This is the command I'm running in the CLI
databricks grants update external-location mdct_bronze --json @"filepath\privileges.json"This is what the privileges.json file looks like
{
"privilege_assignments": [
{
"principal": "ml",
"privileges": [
"ALL_PRIVILEGES"
]
}
]
}The only output I'm receiving when running the command is
{}However, when I update the privileges from the UI and run
databricks grants get external-location mdct_bronze --principal mlI receive the following output
{
"privilege_assignments": [
{
"principal":"ml",
"privileges": [
"ALL_PRIVILEGES"
]
}
]
}Is there something wrong with the json configuration?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2025 02:34 AM
If someone needs this in the future, like I did.
The issue is with your JSON structure. The Databricks CLI uses "changes" with "add" instead of "privilege_assignments" with "privileges".
{
"changes": [
{
"principal": "mailid",
"add": [
"USE_CATALOG"
]
}
]
}To remove the old ALL_PRIVILEGES first:
{
"changes": [
{
"principal": "mailid",
"remove": [
"ALL_PRIVILEGES"
],
"add": [
"USE_CATALOG"
]
}
]
}Then run:
databricks grants update catalog demo_cat --json @privileges.json
Verify the changes:
databricks grants get catalog demo_cat
The key difference is using "changes" array with "add"/"remove" actions instead of "privilege_assignments" with "privileges".