0

I am trying to read keyvault secret from Synapse notebook using:

s = TokenLibrary.getSecret(kv, secret_name)

It works when I am running it in debug mode, but fails when it is scheduled. I granted Synapse server managed identity Get and List secret policy. What is different when it is scheduled?

CHEEKATLAPRADEEP
  • 12,191
  • 1
  • 19
  • 42
DejanS
  • 96
  • 9
  • Are you running synapse notebook using pipeline? 'but fails when it is scheduled' can you give information like how you scheduled this? – Rakesh Govindula Nov 27 '22 at 15:47
  • So, notebook is referenced by a Synapse pipeline And Synapse pipeline is scheduled by Synapse Trigger – DejanS Nov 27 '22 at 22:32
  • Can you share the documentation that you're following? Or any error messages that you're getting? – James Tran Nov 28 '22 at 23:30
  • I've found this library here: https://learn.microsoft.com/en-us/azure/synapse-analytics/spark/apache-spark-secure-credentials-with-tokenlibrary?pivots=programming-language-python I got this error: Access token couldn't be obtained – DejanS Dec 03 '22 at 17:18
  • Py4JJavaError Traceback (most recent call last)\n in \n 1 kv = 'dakeyvaultdev'\n----> 2 tpldm_scrt = TokenLibrary.getSecret(kv, \"cm-account\")\n 3 print(tpldm_scrt)\n\n~/cluster-env/clonedenv/lib/python3.8/site-packages/py4j/java_gateway.py in __call__(self, *args)\n 1302 \n 1303 answer = self.gateway_client.send_command(command)\n-> 1304 return_value = get_return_value(\n 1305 answer, self.gateway_client, self.target_id, self.name) – DejanS Dec 03 '22 at 17:20
  • same error occurs when I put linked service as a 3rd parameter in function call: TokenLibrary.getSecret(kv, "cm-account", "ls_local_kv") – DejanS Dec 04 '22 at 17:49

0 Answers0