Share via


Аутентификация в независимые базы данных

???? ??????!

?? ????? ????? ?????? ????????????? ? ??????? ???????? ????????? ???????, ?????????? ???????????, ?????????????? ? ????? ?????? SQL Server-? – ?????????????? ? ??????????? ???? ?????? ??? ??????????? ??????????????. ??? ???, ??? ????????, ????????: https://blogs.msdn.com/b/sqlsecurity/

? ????? ? ????????? ????????? ?? ???????…

? Microsoft SQL Server “Denali” (CTP1) ???? ???????????? ????? ???????????????? -   ??????????? ???? ?????? ( Contained Db ??? CDB) .

??? ???????????? ????????, ??????????? ???? ?????? ?????? ???? ??????????????, ?? ???????? ?? ????????? ????????. ??????????? ???? ?????? ????? ?????????? ????? ??????? ?????????. ?????? ?????????????? ? ?????? ???????, ????? ???? ?????? ?????? ???????????? ??? ????????????????, ?? ?????? ??????? ?????????????? ????????.

????? ?? ???????? ???????????? ??????????? ???? ?????? ???????? ????????????? ?? ??????? (???????, ??? ????????, ???????? ?????????? ????????? ? ?????? ? ???????????????? ????? ?????? ?? ???????????). ????? ???????, ??????????? ?? ???? ???????????, ???? ?????? ?????????? ????? ?????????.

????? ??????????? ????? ??????????? ???? ??????? ??????? Contained User??? User with Password.

??????????? user – ??? user ???????????????????? ? ??????? ? master-?, ??????? ?????????? ? ???????????????? ???? ?????? ????? ???? ?????? ? ????? ???????????? ???????? ? ???? ??????.

??? SQL Server users ??? ???????? ????? ?????????, ??????????? ????????? ????? ????????????? ? ????????. Windows users ????? ???? ??????? ???????????? ???????.

-- sysadmin ?????? ???? ????????? ????????????? ??????????? ??? ?????? ?? SQL Server-?

sp_configure 'show advanced', 1;

RECONFIGURE WITH OVERRIDE;

go

sp_configure 'contained database authentication', 1;

RECONFIGURE WITH OVERRIDE;

go

-- ???????? ??????????? ???? ??????

CREATE DATABASE db_Contained

CONTAINMENT = PARTIAL;

go

USE db_Contained;

go

-- ???????? ???????????? SQL Server user-?

CREATE USER usr_Contained

WITH PASSWORD = 'LJDUT9!@$';

go

-- ???????? Windows user-?

CREATE USER [DOMAIN\User_01];

go

User, ??????? ?????????? ?????? ? ??????????? ???? ?????? ????? ???????????? ?????? ? ???? ???? ??????, ?? ????? ???????? ???? ?????? ?, ???????????, ?? ????? ???? ??? ???? ??????, ??? ?? ??? ??????.

Windows user, ????????? ? ??????? ????, ????? ???? contained ??? not-contained ? ??????????? ?? ????, ?????????? ?? ??????????????? ????? (DOMAIN\User_01) ? master-?. ???? ????? ????? ??????????, ??, ????????? ????, user ????? ????? ????? ??? ?????? ???? ??????, ????? ?????? ???? ?????? ?, ? ?????, ?? ???????? contained. ???? ????? ????? ?? ??????????, ?? ????? user ???????? ????? ?????????? contained user-?, ?????????? ????. ????? ???????, Windows user ????? ?????? ???? ????????, ? ??????????? ?? ???? ??? ?? ?????? ??? ?????? ??????????????? ?????. ??? ?? ??????, ??? ?? ?????, ?????? ?? ????????? ??????????, ?.?. ?????? ???? ?????? ??????????? ?????? user-? ???????? ???????????.

????????? connection string ???????? ??????????. ??? ?????? ? ??????????? ???? ?????? ?????????? ??????? ??? ???? ???? ??????, ??? user-? ? ??? ?????? (???? ??? SQL Server user):

 

??????????? ???????