无法使用属于 AD 组的登录创建数据库范围的凭据

Cannot create database scoped credential with a login that is part of an AD group

我正在尝试找到允许通过 Azure SQL 服务器中的 AD 组分配权限的用户通过以下语法创建数据库范围的凭据所需的最低权限或角色。

CREATE DATABASE SCOPED CREDENTIAL [SomeCredential] 
    WITH IDENTITY = N'someSqlUser', SECRET='someSqlPassword';

根据文档,需要以下权限。

GRANT CONTROL ON DATABASE::[MyDatabase] TO [SqlAdminGroup]

当该组中的某人尝试创建数据库范围的凭据时出现以下错误:

The specified schema name "personInSqlAdminGroup@mytentant.com" either does not exist or you do not have permission to use it.

所以有趣的是,当我尝试使用个人 SQL 登录时,我特别授予了登录 CONTROL 权限,它起作用了。当我通过授予 AD 组来尝试此操作时,我得到了指定的架构名称错误。我添加了默认架构为 DBO 的组。

我认为 SQL 中的 AD 组存在问题,没有默认架构,因此任何对象创建都需要使用 [dbo].[object] 完全限定对象。但是,数据库范围的凭据似乎不需要模式,因为指定它会导致解析错误。

CREATE DATABASE SCOPED CREDENTIAL [dbo].[SomeCredential] 
    WITH IDENTITY = N'someSqlUser', SECRET='someSqlPassword';

那么,如果它不需要架构,为什么会抱怨用户的指定架构名称不存在?

这是一个记录在案的问题 Use Azure Active Directory authentication。引用“Azure AD 功能和限制”中的相关项目符号:-

Azure AD users that are part of a group that has db_owner server role cannot use the CREATE DATABASE SCOPED CREDENTIAL syntax against Azure SQL Database and Azure Synapse. You will see the following error:

SQL Error [2760] [S0001]: The specified schema name 'user@mydomain.com' either does not exist or you do not have permission to use it.

Grant the db_owner role directly to the individual Azure AD user to mitigate the CREATE DATABASE SCOPED CREDENTIAL issue.

db_owner 角色成员资格与您的 CONTROL on database 方案不完全匹配,但它看起来可能是相同的潜在问题。我没有将此显示为架构错误的解释。