Creating Azure SQL User

This Tutorial is mainly for PowerApps.

When you connect your Power Apps to an azure SQL, you should provide limited access specially on which tables they can make changes. Below is an example of give read access to all tables but restricting the user to only edit certain tables.

Step 1: On your Master Database:

CREATE LOGIN BT_AppUser WITH PASSWORD = '@veryC0mP71c@t3D=P@$$w0rD' ;
CREATE USER  BT_AppUser FROM LOGIN BT_AppUser WITH DEFAULT_SCHEMA=dbo ;
SQL

Step 2: On your Actual Database

CREATE USER BT_AppUser FROM LOGIN BT_AppUser WITH DEFAULT_SCHEMA=dbo;
ALTER ROLE db_datareader ADD MEMBER BT_AppUser ;
SQL

Step 3: A: Assign table access to directly to a user

--To add access
GRANT INSERT, SELECT , UPDATE, DELETE ON dbo.TableName TO BT_AppUser;

--To remove the access access
REVOKE INSERT, SELECT , UPDATE, DELETE ON dbo.TableName TO BT_AppUser;
SQL

Step 3:B: Assign table access to a group and add to the user to the group.

--Create the group
CREATE ROLE AppUser_Group;

--To add access
GRANT INSERT, SELECT , UPDATE, DELETE ON dbo.TableName TO BT_AppUser

--Add the user to the group
ALTER ROLE AppUser_Group ADD MEMBER BT_AppUser;
SQL

Leave a Reply

Your email address will not be published. Required fields are marked *