- Error number
- 15247
- Severity
- 16 (user-correctable error)
- State
- 1
- Product
- Microsoft SQL Server Database Engine
- Versions
- All supported SQL Server versions (2016 to 2025), Azure SQL Database, Azure SQL Managed Instance
- Category
- Logins & Permissions
- Last reviewed
- 23 October 2026
On this page
What it means
Error 15247 means a security statement (such as creating a user, role or schema) was refused because the current user lacks the permission that statement needs.
Statements that manage principals and schemas check a specific permission before they run: CREATE USER needs ALTER ANY USER, CREATE ROLE needs CREATE ROLE, and CREATE SCHEMA needs CREATE SCHEMA on the database. When the check fails, SQL Server returns this generic message. Unlike error 229 and error 262, it does not name the permission, so you work it out from the statement that failed.
15247 is often described as a server-level error, but our reproductions were all inside one database: an ordinary database user trying to create a user, a role or a schema. Server-level security statements (logins, server settings) also check server permissions such as ALTER ANY LOGIN; we did not reproduce those here, because the lab does not touch logins. When the header names a system procedure (sp_grantdbaccess, sp_change_users_login), the procedure made the same check.
Common causes
- An application or deployment account with data rights (db_datareader, db_datawriter) or DDL rights (db_ddladmin) tries to create database users, which needs ALTER ANY USER.
- A script creates roles or schemas as part of a deployment, but the account has neither the CREATE ROLE or CREATE SCHEMA permission nor membership of db_securityadmin or db_accessadmin.
- A legacy procedure such as sp_grantdbaccess or sp_change_users_login is run by an account without the matching permission.
- A login without ALTER ANY LOGIN (or securityadmin) runs a server-level security statement, such as creating or altering another login (documented permission; not reproduced here).
Diagnose it
Read-only These queries only read metadata and dynamic management views. They do not change data, permissions or configuration, so they are safe to run first.
Check the permissions the failing statement needs
Run while connected as the account that got the error, in the same database.
SELECT HAS_PERMS_BY_NAME(DB_NAME(), N'DATABASE', N'ALTER ANY USER') AS can_create_users,
HAS_PERMS_BY_NAME(DB_NAME(), N'DATABASE', N'CREATE ROLE') AS can_create_roles,
HAS_PERMS_BY_NAME(DB_NAME(), N'DATABASE', N'CREATE SCHEMA') AS can_create_schemas,
HAS_PERMS_BY_NAME(NULL, NULL, N'ALTER ANY LOGIN') AS can_manage_logins; 0 in the column that matches the statement confirms the missing permission.
List everything the connection may do in this database
SELECT permission_name
FROM sys.fn_my_permissions(NULL, N'DATABASE')
ORDER BY permission_name; A user with only CONNECT and a few VIEW permissions cannot run any security statement.
Check membership of the roles that can manage security
SELECT IS_ROLEMEMBER(N'db_accessadmin') AS db_accessadmin,
IS_ROLEMEMBER(N'db_securityadmin') AS db_securityadmin,
IS_ROLEMEMBER(N'db_owner') AS db_owner,
IS_SRVROLEMEMBER(N'securityadmin') AS securityadmin; 1 means the connection is a member. Microsoft documents ALTER ANY USER and CREATE SCHEMA for db_accessadmin, and ALTER ANY ROLE and CREATE SCHEMA for db_securityadmin; in our tests db_accessadmin could create users and schemas, and db_securityadmin could create roles.
How to fix it
Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.
Run security changes with an administrative or deployment account
Client or network sideCreating users, roles and schemas is usually a deployment or administration task. Run that part of the script with the account meant for it and keep the application account without these rights.
Grant only the permission the statement needs
Changes permissionsGrant to a role rather than to individual users. These grants were each enough for the matching statement in our tests.
GRANT ALTER ANY USER TO [DeployUser]; -- CREATE USER
GRANT CREATE ROLE TO [DeployUser]; -- CREATE ROLE
GRANT CREATE SCHEMA TO [DeployUser]; -- CREATE SCHEMA
Use the fixed database role for the job
Changes permissionsdb_accessadmin manages database access (users), db_securityadmin manages roles and permissions.
Caution: Microsoft notes that members of db_securityadmin can potentially elevate their privileges and that their actions should be monitored. Treat it as an administrator role.
ALTER ROLE db_accessadmin ADD MEMBER [DeployUser];
-- or, for role and permission management:
-- ALTER ROLE db_securityadmin ADD MEMBER [DeployUser];
For login management, grant ALTER ANY LOGIN
Changes permissionsIf the failing statement works on logins rather than database users, the account needs the server permission ALTER ANY LOGIN (or membership of securityadmin). Grant it in master, by an administrator, only to accounts that really manage logins.
USE master;
GRANT ALTER ANY LOGIN TO [LoginAdmin];
Examples
CREATE USER without ALTER ANY USER
CREATE USER AppUser WITHOUT LOGIN;
ALTER ROLE db_datareader ADD MEMBER AppUser;
ALTER ROLE db_datawriter ADD MEMBER AppUser;
EXECUTE AS USER = 'AppUser';
CREATE USER ReportUser WITHOUT LOGIN; -- needs ALTER ANY USER
REVERT;
Msg 15247, Level 16, State 1, Line 6 User does not have permission to perform this action.
Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.
CREATE ROLE without the CREATE ROLE permission
CREATE USER AppUser WITHOUT LOGIN;
EXECUTE AS USER = 'AppUser';
CREATE ROLE ReportReaders;
REVERT;
Msg 15247, Level 16, State 1, Line 4 User does not have permission to perform this action.
Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.
CREATE SCHEMA by a user who may only create tables
CREATE USER AppUser WITHOUT LOGIN;
GRANT CREATE TABLE TO AppUser;
EXECUTE AS USER = 'AppUser';
GO
CREATE SCHEMA staging;
GO
REVERT;
Msg 15247, Level 16, State 1, Line 1 User does not have permission to perform this action. Msg 2759, Level 16, State 1, Line 1 CREATE SCHEMA failed due to previous errors.
Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.
How to prevent it
Split deployment scripts into data and schema changes run by the deployment account, and security changes (users, roles, schemas, logins) run by an administrator or a dedicated account with exactly those permissions. Then the application account never needs any of them.
Prefer the narrow grants above over db_owner or server roles, and review who holds ALTER ANY USER, db_accessadmin and db_securityadmin from time to time. The SQL Server security lesson explains how logins, users, roles and schemas fit together.
Common questions
Is error 15247 always a server-level permission problem?
No. We reproduced it entirely inside one database: CREATE USER, CREATE ROLE and CREATE SCHEMA run by a user without the matching database permission. Server-level security statements can fail with it too.
Which permission does CREATE USER need?
ALTER ANY USER on the database. Members of db_accessadmin and db_owner have it.
Why does the message not say which permission is missing?
Error 15247 is a generic message shared by many security statements and procedures. Match the statement to its documented permission, then confirm with HAS_PERMS_BY_NAME as shown in the diagnostics.
Learn more on CodeWithSQL
Official documentation
- CREATE USER (Transact-SQL)
- CREATE ROLE (Transact-SQL)
- Database-level roles (Microsoft Learn)
- Database engine events and errors 15000 to 15999
Last technically reviewed 23 October 2026; examples and diagnostics run on SQL Server 2025 (17.0.1145.4). Message text checked against the engine's sys.messages catalogue.