Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Microsoft Azure SQL – Create SQL User

Posted on October 13, 2016 By David Kittell

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.

Related

Azure Code MSSQL MSSQL - Azure SQL

Post navigation

Previous post
Next post

Related Posts

Mac OSX Terminal – Get Mac Internal/External IP

Posted on June 17, 2016June 7, 2019

#!/bin/bash clear # Get IP – Start ip=$(ipconfig getifaddr en0) nen=0 while [ -z $ip ]; do let nen=nen+1 eth="en$nen" #echo $eth ip=$(ipconfig getifaddr $(echo $eth)) done echo "Internal IP: " $ip # Get IP – Stop #Variables – stop #echo "External IP: " $(curl -s https://www.kittell.net/ip.php) echo "External IP:…

Read More

MacPorts / HomeBrew – Rip CD tracks from terminal

Posted on May 22, 2016November 5, 2017

I’m mainly doing this project for my church where the CD will typically only have one track and the MP3 bitrate is acceptable at 64 kbit/s Yes there are faster options that also are free but this is the best option I’ve found to make it an easy process someone…

Read More

MSSQL Format U.S. Phone Number

Posted on October 13, 2014October 26, 2015

SELECT CASE LEN(phone) WHEN 11 THEN LEFT(phone, 1) + STUFF(STUFF(STUFF(phone, 1, 1, ‘ (‘), 6, 0, ‘) ‘), 11, 0, ‘-‘) WHEN 10 THEN STUFF(STUFF(STUFF(phone, 1, 0, ‘ (‘), 6, 0, ‘) ‘), 11, 0, ‘-‘) WHEN 7 THEN STUFF(phone, 4, 0, ‘-‘) ELSE ‘Invalid phone’ END AS ‘Formatted Phone’…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes