Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-DbaAgentJobCategory authentication failure #5034

Closed
dylan-azucena opened this issue Feb 1, 2019 · 1 comment · Fixed by #5042
Closed

New-DbaAgentJobCategory authentication failure #5034

dylan-azucena opened this issue Feb 1, 2019 · 1 comment · Fixed by #5042
Labels
bugs life good first issue help appreciated If you have time to swing by and submit a PR to fix some things, we would greatly appreciate it

Comments

@dylan-azucena
Copy link

Steps to Reproduce

<#
    $credential = Get-Credential
    New-DbaAgentJobCategory -SqlInstance db1 -SqlCredential $credential -Category "Daily" -CategoryType "LocalJob"
#>

Expected Behavior

Agent job category is created and passes back the new category info.

Actual Behavior

Running this produces the following error:

[Get-DbaAgentJobCategory] Failure | Cannot authenticate using Kerberos. 
Ensure Kerberos has been initialized on the client with 'kinit' and a Service Principal Name has been registered for the SQL Server to allow Kerberos authentication.

Of course, I'm not trying to authenticate with Kerberos, I'm passing in SQL credentials. The target server is setup for mixed authentication.
I'm pretty sure this coming from this line, which needs to also include the -SqlCredential parameter.

Environmental data

  • PowerShell:
PSVersion                      6.1.1
PSEdition                      Core
GitCommitId                    6.1.1
OS                             Darwin 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0 
  • SQL Server:
Microsoft SQL Server 2017 (RTM-CU5) (KB4092643) - 14.0.3023.8 (X64) 
	Mar  2 2018 18:24:44 
	Copyright (C) 2017 Microsoft Corporation
	Standard Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor)
@wsmelton wsmelton added help appreciated If you have time to swing by and submit a PR to fix some things, we would greatly appreciate it good first issue bugs life labels Feb 1, 2019
@wsmelton
Copy link
Member

wsmelton commented Feb 1, 2019

@dylan-azucena You would be correct on this one with the problem line:

https://github.com/sqlcollaborative/dbatools/blob/a1e9f920e0512ac6d34bce2ad3e2587821df7360/functions/New-DbaAgentJobCategory.ps1#L117

If you would like to submit a PR, that lines needs to be updated to pass in the $server variable instead of the $instance variable. The $server variable has the connection object already made and passing that will ensure the same connection to perform the previous work is already done.

So it should basically look like this:

Get-DbaAgentJobCategory -SqlInstance $server Category $cat 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs life good first issue help appreciated If you have time to swing by and submit a PR to fix some things, we would greatly appreciate it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants