AZURE DATABRICKS - How To Modify existing Secret Scope?
Let's get to the technicalities then.
The other day I stumbled upon this error while running a DBx notebook
User username@domain.com does not have READ permission on scope xxx_yyy to perform this action.
So the problem statement was to find out the details of scope xxx_yyy.
I assume if you are reading this article you will have an idea of what secret scopes are in context to Azure Databricks.
You can read more on it here Secret Scopes - Azure DBx
Now I will list out the steps to create and manage secret scopes. Creating can be done through UI on azure portal but for managing the scope the process is little different. Please go through the following steps
CREATE
1. For creating scopes using key vault open the following web page<yourdatabricksurl>#secrets/createScope2. Refer to the step detailed in this article
MANAGE/MODIFY
For managing scopes, we'll have to use CLIs. It cant be done using portal
1. Make sure python is installed and the path is copied to be used in subsequent step.The path will look like this -
C:\Users\Arnold Commando\AppData\Local\Programs\Python\Python39
2. Open command prompt and make sure you are under this pathcd C:\Users\Arnold Commando\AppData\Local\Programs\Python\Python393. Navigate to https://bootstrap.pypa.io/get-pip.py and copy the code in notepad file. Give it a name get-pip.py and make sure it is saved underC:\Users\Arnold Commando\AppData\Local\Programs\Python\Python394. run this commandpython get-pip.py5. For steps 3 and 4, you can refer to this article6. Install data bricks CLI by using below commandpip install databricks-cli7. Downgrade the cli version by using below commandpython -m pip install --upgrade pip setuptools wheel databricks-cli==0.11.08. run the following commanddatabricks configure --tokenMake sure you are inside scripts foldercd C:\Users\Arnold Commando\AppData\Local\Programs\Python\Python39\Scripts9. The Interface will ask for "Databricks Host (should begin with https://):"[What I entered]https://eastus.azuredatabricks.net10. Interface will now ask for"Token:"Generate token from databricks workspace and paste here.11. Run the following command to see if the authentication was succesfullydatabricks fs ls12. It should return, something likemlmnttmp13. Run the following command to check the scope detailsdatabricks secrets list-acls --xxx_yyy <secret scope name>14. Modify the permissions by using below commanddatabricks secrets put-acl --scope <secret scope name> --principal <username@domain.com> --permission READ
So here it is. Hope this was helpful.
Comments
Post a Comment