You have created a Python Notebook which runs successfully as an individual notebook but you are trying to run the Notebook in a SQL Agent Job as a Notebook Job like this https://blog.robsewell.com/blog/running-jupyter-notebooks-as-agent-jobs/
The error that you are receiving is from the Agent Job Step 'Exec Notebook' which you can find by editing the Agent Notebook Job in ADS and then the Job Step. My feeling is that it is not correctly locating the instance.
click in the job step and press edit
The problem is that in this code there is no value set for the Invoke-SqlCmd cmdlet so it is using the hostname which is obviously no good when you have a named instance. I get login failures on my default instance for the named instance agent service account when I try to run a Notebook Agent Job on a named instance.
A quick solution is to add this to the PowerShell code step at the top
$SqlInstance = '{0}\{1}' -f "$(ESCAPE_SQUOTE(MACH))", "$(ESCAPE_SQUOTE(INST))"
$PSDefaultParameterValues = @{
"Invoke-SqlCmd:ServerInstance" = $SqlInstance
}
What is this doing?
It is creating a variable named SqlInstance that is made up of the SQL Agent Job Tokens for the machine and the instance name
Then it is setting that variable as the default value for the ServerInstance paramater of the Invoke-SqlCmd cmdlet for this session only
This means that all of the times that the Invoke-SqlCmd cmdlet is called it will use the correct value.
You should probably make this a default for you to add to any Notebook Agent job
This resolved this error for me
Let me know how you get on