Author: Onur Kulabas
Date: 19 Nov, 2020

Creating Database Users without Logins / Contained Database Authentication

Contained databases include all database settings and metadata to define the database and has no configuration dependencies on the SQL Server Instance. Users can connect to the database without authenticating a login at the instance level. Isolating the database from the Database Engine helps easily move the database to another instance of SQL Server.

To enable contained database, use this command;

sp_configure 'contained database authentication', 1

To create users without logins, use this command;

USE AnyDB;
CREATE USER AnyUser WITH PASSWORD = ’Str0ngP@ssword’;

If you are trying to connect to a contained database using a contained user credentials via interface, Click Options (on the right bottom) and choose the database.

If you don't specify the database to connect to, connection will fail because SQL Server is looking for a login in master database that doesn't exist.

Pinea Blog

Follow us for the latest technology news!

SQL JSON_VALUE
06Dec
Query Store
 

Query Store is a new feature introduced in SQL Server 2016. It can be considered as a flight recorder or a black box...

Continue Reading ...
SQL JSON_VALUE
19Nov
Creating Database Users
without Logins

Contained databases include all database settings and metadata to define the database and has no ...

Continue Reading ...
PM2
30Oct
PM2

PM2 is an advanced process manager for the JavaScript runtime Node.js. You can manage your node packages on...

Continue Reading ...
SQL JSON_VALUE
24Oct
SQL Server
JSON_VALUE Function

JSON_VALUE function can be used to extract scalar value from a given JSON string on SQL Server...

Continue Reading ...
CORS
21Oct
What is
CORS?

Cross-origin resource sharing (CORS) is the mechanism that manages the cross-domain requests, ...

Continue Reading ...