mmayorga
Databricks Employee
Databricks Employee

Hi @TetianaDromova 

Thank you for reaching out and waiting for a response.

Having your code working on a notebook is a significant first step, so you are on the right path, but then moving into a Python file, we must consider specific details:

  1. How is this Python code/file being executed? In a Lakeflow Job as a task?
  2. If it is in a Job, what user/service principal is configured to execute this job and task of your Python Code?
    1. When you run code in a notebook, it uses your own credentials, which likely have all the required permissions. However, when running as a Job, the code may run under a different user or principal. You must ensure that this Job principal has the necessary permissions to access your volume in order to read the encrypted file. The same requirement applies to the access to the scope and secrets.
  3. Are you using the same cluster with the same libraries installed to execute your notebook and Python files for consistency?

Based on the error provided, the issue likely occurs when accessing the volume or the secrets, which prevents proper decryption.

I hope this helps!