We are trying to use SQL Server trigger for scaling application and trying to authenticate the SQL DB using Azure Service Principle. But no luck. We are keeping connection string in Kubernetes Secret and trying to use this. but no luck. Getting login failed error like
ERROR mssql_scaler Found error pinging mssql: mssql: login error: Login failed for user xxxxxxxxx
But application able to access DB using same connection string. Any solution or work around for this?
But every thing is working fine when we are using SQL Authentication instead of service principal.
Below is the connection string format we are using
kubectl create secret generic my-mssql-secrets --from-literal mssql-connection-string="server=azuse2sqlmixxxxx.xxxxxxx.database.windows.net;Authentication=ActiveDirectoryServicePrincipal;Initial Catalog=yyyyyy;User Id=99775ec3-xxxxxx-xxxx-xxx;Password=xxxxxxxx;Persist Security Info=False;Encrypt=True;TrustServerCertificate=True;"\*\*
Keda Meta Data Details –
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: keda-trigger-auth-mssql-secret
spec:
secretTargetRef:
- parameter: connectionString
name: my-mssql-secrets
key: mssql-connection-string
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: mssql-scaledobject
spec:
minReplicaCount: 1
maxReplicaCount: 10
scaleTargetRef:
name: app-MyApplicationName
triggers:
- type: mssql
metadata:
targetValue: “{{ .Values.kedaTargetValue }}”
query: “{{ .Values.kedaQuery }}”
authenticationRef:
name: keda-trigger-auth-mssql-secret
Please help here if you have any solution or work around.
Below is the connection string format we are using –
**
kubectl create secret generic my-mssql-secrets –from-literal mssql-connection-string=”server=azuse2sqlmixxxxx.xxxxxxx.database.windows.net;Authentication=ActiveDirectoryServicePrincipal;Initial Catalog=yyyyyy;User Id=99775ec3-xxxxxx-xxxx-xxx;Password=xxxxxxxx;Persist Security Info=False;Encrypt=True;TrustServerCertificate=True;”**
Keda Meta Data Details –
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: keda-trigger-auth-mssql-secret
spec:
secretTargetRef:
- parameter: connectionString
name: my-mssql-secrets
key: mssql-connection-string
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: mssql-scaledobject
spec:
minReplicaCount: 1
maxReplicaCount: 10
scaleTargetRef:
name: app-MyApplicationName
triggers:
- type: mssql
metadata:
targetValue: “{{ .Values.kedaTargetValue }}”
query: “{{ .Values.kedaQuery }}”
authenticationRef:
name: keda-trigger-auth-mssql-secret