How to create user in remote database using elastic query ?

Palash Mathur 0 Reputation points
2024-07-23T19:08:45.07+00:00

I am trying to use elastic query to connect to remote database and create user there. I have used total three ways to create Database scope credentials:

Using SQL users:
CREATE DATABASE SCOPED CREDENTIAL ElasticDBQueryCred WITH IDENTITY='<username>', SECRET = '<password>';

Using Service principle:
CREATE DATABASE SCOPED CREDENTIAL ElasticDBQueryCredSPN WITH IDENTITY='<SPN_ID>', SECRET = '<SPN_SECRETE>';__

Using entra ID:__
CREATE DATABASE SCOPED CREDENTIAL ElasticDBQueryCredAAD WITH IDENTITY='<admin_entra_id>';

In all three cases above, I am getting the same error:
*SQL Error [33159] [S0001]: Principal 'entraID_of_user' could not be created. Only connections established with Active Directory accounts can create other Active Directory users.
*
Is there a way to connect to a remote database and create a user on the remote database using an elastic query?

Azure SQL Database
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 106.8K Reputation points
    2024-07-23T19:43:03.6033333+00:00

    Since elastic query is only possible with username+password, and the error message says that to create Entra ID accounts, you must be logged in with an Entra ID account, it seems that you lose.

    0 comments No comments