Aller au contenu principal

Azure SQL Database

Azure SQL Database can be authenticated using Microsoft Entra ID. All new databases should only allow authentication through Microsoft Entra.

Enabling Microsoft Entra authentication

Authentication is enabled at the server level. This step will be done by a Genisys admin. Admin name must be connected to a security group instead of a single user.

Firewall configuration

Network firewall is still required as we don't want to allow any IP to try to connect to the database, even though we are using Microsoft Entra security.

Microsoft Entra Groups configuration

To simplify the configuration process, create the following groups for each database you are creating.

DB-DBNAME-OWNER

Add members that will require read/write access to the database. This usually includes the AppService Service Principal, the Azure DevOps service connection. Genisys employees that would require access to run a script or modify data would be added to the group temporarily.

DB-DBNAME-READER

Add members that will require read-onlyaccess to the database. Genisys employees to would require access to view some data would be added to the group temporarily.

Create your SQL database using the portal.

As an administratorConnect to your database using SSMS.

Select your new database and execute the following scripts:

CREATE USER [DB-{DBNAME}-OWNER]
FROM EXTERNAL PROVIDER
WITH DEFAULT_SCHEMA = dbo
GO


-- Add user to the database owner role
EXEC sp_addrolemember N'db_owner', 'DB-{DBNAME}-OWNER'
GO

CREATE USER [DB-{DBNAME}-READER]
FROM EXTERNAL PROVIDER
WITH DEFAULT_SCHEMA = dbo
GO


-- Add user to the database owner role
EXEC sp_addrolemember N'db_owner', 'DB-{DBNAME}-READER'
GO