Getting Failed to determine members of SqlServerTarget (server name 'data-engineering-server-rnd.database.windows.net', server location 'data-engineering-server-rnd.database.windows.net'): Login failed for user 'sqladmin'. error with elastic job

Ayush Shrivastava 100 Reputation points
2024-07-10T11:16:45.74+00:00

I am trying to run a job inside my server.

Steps I followed

Created a SQL Server Agent on server 1.

Ran following queries and also the Elastic job agent is hosted in server1 only and the database is ElasticJobs.

  • CREATE MASTER KEY
  • CREATE DATABASE SCOPED CREDENTIAL refresh_credential WITH IDENTITY = 'sqladmin', SECRET = 'abcd1234'
  • EXEC jobs.sp_add_target_group_member @target_group_name = 'DBLocal', @target_type = 'Sqlserver', @refresh_credential_name = 'refresh_credential', @server_name = 'server1';
  • EXEC jobs.sp_add_job @job_name = 'AddNewTablel', @description = 'Create Table Test';
  • Add job step for create table EXEC jobs.sp_add_jobstep @job_name = 'AddNewTablel', @command = N**'CREATE TABLE [dbo].[Employee] ([Id] [int] NOT NULL, Name varchar(200), Address varchar(200));'**, @credential_name = 'refresh_credential', @target_group_name = 'DBLocal';
  • EXEC jobs.sp_start_job 'AddNewTablel'

Now after doing all these I am getting this error.

Failed to determine members of SqlServerTarget (server name 'data-engineering-server-rnd.database.windows.net', server location 'data-engineering-server-rnd.database.windows.net'): Login failed for user 'sqladmin'.

I was also getting error that my ip is not listed and hence cannot access the server but I am still getting this error after adding my ip to the firewall as well.

Can someone please help with this. Am I missing some authentication thing here?

Azure SQL Database
{count} votes

2 answers

Sort by: Most helpful
  1. Ayush Shrivastava 100 Reputation points
    2024-07-15T12:11:55.96+00:00

    This is resolved since I was using an invalid user. I added my server level user and it worked for me.


  2. Oury Ba-MSFT 19,176 Reputation points Microsoft Employee
    2024-07-15T16:12:37.4966667+00:00

    @Ayush Shrivastava Thank you for reaching out.

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!

    Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer. Accepted answers show up at the top, resulting in improved discoverability for others.

    Issue: Getting login failed for user "sqladmin" error with elastic job

    **Solution: "**This is resolved since I was using an invalid user. I added my server level user and it worked for me."

    If your issue remains unresolved or have further questions, please let us know in the comments how we can assist. We are here to help you and strive to make your experience better and greatly value your feedback.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.