Reputation: 17
I have a secret saved in the Azure key vault and want to access it in the Synapse analytical pipeline when I run the manual notebook it does not give an error and I get my secret in the output of the notebook. Still, when I run the notebook through a pipeline it gives an error, and an error message is attached below while I have already added the access policy in my Azure key vault and my email ID, as well as my workspace name. Error Details
I aim to get the key vault secret value in my notebook through the pipeline run not manually.
from notebookutils import mssparkutils
mssparkutils.credentials.getSecret('kv-dp-WorkspaceName','TestNoteBook')
The above two lines of code give me the secret value when I run the notebook manual.
Upvotes: 1
Views: 1498
Reputation: 8382
To get secret by calling notebook in pipeline you need to spacify key vault liked service name in the code.
First crate linked service to particular Key vault below:
In key vault assingn appropeiate permission to managed identitiy of service principal of syampse workspace:
Then Run below code in synaps notebook
from notebookutils import mssparkutils
mssparkutils.credentials.getSecret('key vault name','secret name','linkedservice name')
Notebook executed from pipeline successfully:
Upvotes: 1