In this example I create a Read-Only user but this will work with any access as long as you change the db_datareader access role to what you need
In SQL Management Studio open a “New Query” with [master] database
USE master GO IF EXISTS ( SELECT * FROM sys.database_principals WHERE NAME = 'dkittell' ) BEGIN DROP USER dkittell DROP LOGIN dkittell END GO CREATE LOGIN dkittell WITH PASSWORD = N'SomethingSuperSecret' GO
Again in SQL Management Studio open a “New Query” with the specific database you want to grant access to
USE [azure_SQL_Database] GO IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'dkittell') BEGIN DROP USER dkittell END CREATE USER dkittell WITH DEFAULT_SCHEMA=azure_SQL_Database GO EXEC sp_addrolemember 'db_datareader', 'dkittell';
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.