gpt4 book ai didi

azure - SQL Server Management Studio - 登录错误 < token 标识的主体>

转载 作者:行者123 更新时间:2023-12-03 01:16:16 24 4
gpt4 key购买 nike

  1. 我有一个 Azure SQL Server 资源,我是该资源的 Azure AD 管理员。我已向另一位无法通过 SQL Server Management Studio 访问数据库的用户提供了资源访问“贡献者”,因为他使用正确的服务器和数据库名称以及使用 MFA 选项的 Azure 身份验证收到以下错误:

enter image description here

  • 然后,我们想到切换到 Azure Data Studio,不知何故数据库已连接到那里,但在那里,问题是用户无法更改表设计,因为会弹出以下错误:
  • enter image description here

    可以采取什么措施来至少解决其中一个问题?

    1. 对于 ADS 和 SSMS,用户是在数据库中创建的,具有 db_datareader、db_datawriter 和 db_ddladmin 权限。他对 Azure SQL Server 实例具有贡献者角色。

    2. 在SSMS中,有时在连接到数据库时,它会访问尝试连接到主数据库的数据库。我们尝试手动输入数据库名称,仍然出现同样的错误。

    3. 在 SQL Server -> Azure AD 管理员 -> 我什至尝试将该用户设置为管理员,即使 SSMS 显示相同的错误。

    请帮忙。

    最佳答案

    对于使用 MFA 到 Azure SQL Server 的 SSMS 连接:

    If you are connecting from SSMS you may also need to change the default database option. By default, it will try to connect to master DB where this user may not exist there as AAD users are contained inside each user database.

    1. 在 SSMS Connect Explorer > 选项 - 连接属性 - 提供数据库名称,然后在登录选项卡 > 作为 Azure AD 身份验证 - 与 MFA 通用,用户名是您的 Azure 帐户用户名。

      enter image description here

      enter image description here

    2. 我已在 Azure 门户中将我的用户设置为 SQL Server 管理员。

    3. 在创建 SQL Server 时,选择了 Azure 提供的示例数据库,并且我更改了表的设计,它按预期工作。

    对于 Azure Data Studio 与 Azure SQL Server 的连接:
    我在 Data Studio Explorer 中给出了以下详细信息以进行连接,并且连接成功:

    enter image description here

    向现有表添加一列:

    enter image description here

    结果:

    enter image description here

    注意:

    1. 要将 SQL Server 身份验证用作具有通用 MFA 的 Azure AD,用户帐户必须是 Azure AD 帐户。
    2. 将该用户设置为 Azure SQL - AD 管理员,并按照 @Junnas 所说的步骤 here - 创建具有授予权限的用户,以便使用数据库角色或数据库权限来处理数据库。
    3. 还可以在 Azure SQL Server 实例级别为该用户授予贡献者角色,方法是转至 Azure 门户 > SQL Server > 访问控制 > 添加角色分配< strong>SQL Server ContributorSQL DB Contributor:

    enter image description here

    关于azure - SQL Server Management Studio - 登录错误 < token 标识的主体>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74793415/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com