Clone wiki

devoops / Azure SQL Database Monitoring

Create a Database User for Monitoring

Database login that is created when a new Azure SQL Database is provisioned is a server-level principal. The server-level principal is used to create other logins and corresponding database users.

Create a login and database user in master database as the server-level principal:

-- in master database
-- create a login
create login <LOGIN> with password = '<PASSWORD>'
-- create a corresponding database user
create user <USER> from login <LOGIN>;

Authorize the login to use a target database as the server-level principal:

-- in target database
-- create a corresponding database user
create user <USER> from login <LOGIN>;
-- grant permission to view dynamic management views
grant view database state to <USER>;

Azure Documentation

Updated