Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Azure Active Directory is only supported on Windows operating systems - azure-sql-database

We are trying to run sql files from Jenkins Linux machine using Liquibase to the Microsoft SQL server db and getting the error as:
ERROR: Build step failed with exception java.lang.RuntimeException:
Error getting database connection using driver
com.microsoft.sqlserver.jdbc.SQLServerDriver using url
jdbc:sqlserver://*********.database.windows.net:***;database=*********;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;Authentication=ActiveDirectoryIntegrated'
at org.jenkinsci.plugins.liquibase.evaluator.AbstractLiquibaseBuilder.createJdbcConnection(AbstractLiquibaseBuilder.java:236)
at org.jenkinsci.plugins.liquibase.evaluator.AbstractLiquibaseBuilder.createLiquibase(AbstractLiquibaseBuilder.java:164)
at org.jenkinsci.plugins.liquibase.evaluator.AbstractLiquibaseBuilder.perform(AbstractLiquibaseBuilder.java:129)at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)at hudson.model.Build$BuildExecution.build(Build.java:205)at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1720)at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)at hudson.model.ResourceController.execute(ResourceController.java:98)at hudson.model.Executor.run(Executor.java:404)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: **Azure
Active Directory is only supported on Windows operating
systems.**at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1289)at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:773)
We have tried connecting directly with SQL server authentication and it was successful but while using Azure service principal credential we are getting this error. How do we use Azure SPN to work with Liquibase?

Are you sure you want to connect using active directory integrated to SQL Azure? You should try to connect using the admin server login of SQL Azure or using a login created on SQL Azure. If that is the case, please look how to create the connection string on the samples contained on below article.
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-connect-query-java
Hope this helps.
Regards,
Alberto Morillo

Related

Why application in Azure Container Instance cannot connect to Azure SQL DB for PostgreSQL?

I have Python application in Azure Container Instance, which tries establish connection to Azure DB for PostgreSQL, but failing. Azure DB firewall is open for Azure services. Connection works fine, when application is connecting from local machine docker.
I wonder what is the problem?
psql: error: FATAL: password authentication failed for user "myuser"
'sales.Customers' table is unavailable - sleeping
* Could not resolve host: hslotp
* Closing connection 0
OTP is unavailable - sleeping
Have you checked the ports match, here is something you can verify from Troubleshoot connection issues to Azure Database for PostgreSQL
make sure you have the latest of psycopg2 release or atleast above 2.8.0
Also, the connection string should looks like below. Make sure you get Server name and login details from Azure portal.
postgresql://user:password#container_name:5432?sslmode=disable
Refer: thon to connect and query data in Azure Database for PostgreSQL

Why the default user can't login into sql server 2012?

I'm trying to run some PowerShell script to install some apps in my pc, the script is trying to create a user and roles for that user in sql server 2012, but I'm getting this error when I installed sql server in mixed mode authentication.
Getting bellow error when I installed the sql server in only windows authentication mode.
What can be the issue? Am I missing any settings?
The reason is written clearly:
cannot open database "Sessions" requested by login
Change it to master and retry

TFS Configuration Error

I am facing a problem that when i try to configure my TFS it show me the following Error Message
Error
TF255049: A connection cannot be made to the server that is running SQL Server. Verify that you have entered the correct name for the server, including the instance name, that the server you are attempting to connect to is online, and that you have the required permissions to connect. If you are attempting to connect to the remote SQL Server instance, then verify that it is configured to allow remote connections, that TCP/IP protocol is both enabled and configured to use port 1433 (default), and that Windows Firewall does not block this port.
Check whether the SQL version is supported by the TFS version: https://www.visualstudio.com/en-us/docs/setup-admin/requirements#sql-server
Check the permission of the account that you use, and make sure it belongs to SysAdmin Server Role.
As #Daniel mentioned in comment, follow the troubleshooting steps provided in the error message, and check this blog to see whether it is helpful: https://elhajj.wordpress.com/2013/02/25/workaround-error-tf255049-punching-a-hole-through-windows-firewall/
I was running an upgrade from TFS 2018 to Azure DevOps 2020.
After the server restart, the Azure DevOps Server Configuration wizard opened.
I was logged in as the local machine administrator and got this error (TF255049: A connection cannot be made to the server that is running SQL Server...) when trying to connect to my SQL Server machine (to chose the configuration database).
I logged in as Network Administrator, started the wizard again and the SQL connection worked.
To restart the Azure DevOps Configuration Wizard again...
Open the Azure DevOps Administration Console and choose Configure Installed Features to open the Server Configuration Wizard...

Cannot connect to sql server 2008 using JDBC

I have tried all the methods to connect to the server.I am using sql server 2008 on mixed authentication mode.I can login via the sql server management studio using the sa login.But when I try accessing the same db from my java program I get the following error:
SQL Exception: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'sa'. ClientConnectionId:191d94bb-a55e-47a0-bb9f-b84638313cf4
This is my connectionstring:
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl= "jdbc:sqlserver://localhost;databaseName=Northwind;user=sa;password=sa;";
I have accessed my database in the same way. One of my problems were that I hadn't enabled the port and IP for the database. Check these options in SQL Server Configuration Manager. Hope this helps =)

SQL Server 2008 - Reporting Services Failed Login for User '...'

Good Afternoon,
I'm having difficulty running a report with a data source saved on the Report Server using credentials for a user I created on SQL Server named 'ReportUser'. Attempting to resolve this I've mapped the user to the 'ReportServer' database with the db_owner role as well as setting the default database to the 'ReportServer'. However, each time I attempt to run the report I receive the error message:
Cannot create a connection to data source 'Test'. Login failed for user 'ReportUser'.
I'm running SQL Server 2008 from my local machine and am able to successfully run the reports when I setup the datasource using Windows Authentication. Any idea on what could be causing the issues when attempting to use the SQL Authentication with the 'ReportUser'
Thank you very much for your help!
Thank you for your reply.
I believe I found the cause of my issue. Since this was a local install for testing purposes I just set up the instance of SQL Server with Windows Authentication. However, I made the mistake of not setting up the server for both Windows and SQL Authentication. The following link helped me resolve this.
http://forums.asp.net/t/1784261.aspx/1?Could+not+connect+to+database+login+failed+for+user+sa
After changing this setting and restarting the SQL Server everything appears to be running properly now.