Skip to content

Instantly share code, notes, and snippets.

@Ninjanaut
Last active October 21, 2021 11:21
Show Gist options
  • Select an option

  • Save Ninjanaut/67f8105945eedb7ab4c404b24217f1e0 to your computer and use it in GitHub Desktop.

Select an option

Save Ninjanaut/67f8105945eedb7ab4c404b24217f1e0 to your computer and use it in GitHub Desktop.
Create login and user in Azure SQL database to prevent VA1143 vulnerability
-- Create Login
CREATE LOGIN ApplicationUser 
WITH PASSWORD = 'foo secured password';

-- Preconditions:
-- Connected to Azure SQL specific database
--------------------------------------------

-- Create User
CREATE USER ApplicationUser
FROM LOGIN ApplicationUser
WITH DEFAULT_SCHEMA=dbo;

-- Grant Roles
ALTER ROLE db_datareader ADD MEMBER [ApplicationUser]; 
ALTER ROLE db_datawriter ADD MEMBER [ApplicationUser];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment