Provisioned SQL server datasource wont connect using Windows auth

I’m trying to track down the cause of this issue and need some help.

Environment
Windows Server 2016
Grafana 6.2.5 commit: 6082d19

Note: this works in Grafana v5.4.4 (commit: e86baa5). I created a vanilla instance of that version of Grafana and the provisioned datasource works just fine.

If I create the datasource via UI and click save and test, it works. If I try to use a provisioned datasource when I click test I receive this exception back:

InitialBytes InitializeSecurityContext failed 8009030c

After a few attempts the windows service account is locked out in Active Directory. I unlock it and wait a few minutes to confirm propagation. Checked AD Audit I can confirm no other machine or external process is locking the account out.

I tried creating a new datasource .yml. I’ve tried putting the password between double quotes, single quotes and without quotes. Does not seem to make a difference. Here is the current format im using in the .yml:

apiVersion: 1

datasources:
  - name: 'Created via provisioner'
    type: mssql
    url: mysqlserver.infra.corp.local
    database: mydatabase
    user: infra\svc_mywindowsaccount
    jsonData:
      maxOpenConns: 0         # Grafana v5.4+
      maxIdleConns: 2         # Grafana v5.4+
      connMaxLifetime: 14400  # Grafana v5.4+
    secureJsonData:
      password: "myPassword"

Curious to see what could be different about the UI created vs provisioned, I checked out what /api/datasources returned and compared the two datasources. Here is what I’m getting:

{
"id": 31,
"orgId": 1,
"name": "Created via UI",
"type": "mssql",
"typeLogoUrl": "public/app/plugins/datasource/mssql/img/sql_server_logo.svg",
"access": "proxy",
"url": "mysqlserver.infra.corp.local",
"password": "",
"user": "infra\\svc_mywindowsaccount",
"database": "mydatabase",
"basicAuth": false,
"isDefault": false,
"jsonData": {
"encrypt": "false"
},
"readOnly": false
}

vs

{
"id": 30,
"orgId": 1,
"name": "Created via provisioner",
"type": "mssql",
"typeLogoUrl": "public/app/plugins/datasource/mssql/img/sql_server_logo.svg",
"access": "proxy",
"url": "mysqlserver.infra.corp.local",
"password": "",
"user": "infra\\svc_mywindowsaccount",
"database": "mydatabase",
"basicAuth": false,
"isDefault": false,
"jsonData": {
"connMaxLifetime": 14400,
"maxIdleConns": 2,
"maxOpenConns": 0
},
"readOnly": true
}

Any ideas on what to try next? I set up a brand-new vanilla instance and provisioned this datasource. I get the same error as above unless I create it via UI.

Did you ever figure out how to set up provisioning in a windows environment? I’m having trouble configuring dashboard provisioning on a windows server.

Hey there - I realize this is a little late but if you’re still running into issues and you think it’s similar to what I am seeing, check out the discussion we had on it here:

TL;DR - the $ character in a password was causing issues for the parser

Can I ask you how you set up the pathways in your ini files and your .yaml files? I’m trying to provision on our server system and haven’t been able to get things to work correctly. I created a thread about it here: