Forum Discussion
Adding users to an AD group with Azure Functions/Logic Apps
Referring this:
Azure function:
[FunctionName("GetUsersFromAPI")]
public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
// Call REST API and get user data
var users = await GetUsersFromAPI();
// Save users to Azure SQL Database await SaveUsersToDatabase(users); return new OkResult();
}
Adding Users to Azure AD Group from SQL:
-- Add user to Azure AD group
EXEC sp_addrolemember 'db_datareader', 'email address removed for privacy reasons';
Set up Microsoft Entra authentication for SQL Server - SQL Server | Microsoft Learn
The following is incorrect:
-- Add user to Azure AD group
EXEC sp_addrolemember 'db_datareader', 'email address removed for privacy reasons';
sp_addrolemember adds a server login or database user to a database role.
It does not add a user to an external directory services (be that Active Directory or Azure Active Directory) group - which to answer your question, tjson , is not directly possible from SQL itself.
Cheers,
Lain