Copy-DbaLogin - Copy the permissions of a login on logins, server roles, endpoints and availability groups

未关闭
#10,834 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
databases, powershell
领域
database

调研方向

Read Copy-DbaLogin, Sync-DbaLoginPermission, and Export-DbaLogin, focusing on how they use Server.EnumServerPermissions and Server.EnumObjectPermissions. The proposal leaves open whether endpoint and availability-group permissions should be copied behind a switch, so first clarify the intended scope. Done means the agreed permissions are copied or scripted correctly, including the behavior for missing securables and renamed logins.

由索引模型根据 Issue 内容生成。

描述

Copy-DbaLogin, Sync-DbaLoginPermission and Export-DbaLogin handle the permissions of a login on the server itself (Server.EnumServerPermissions, class 100 in sys.server_permissions), its server roles, its database users and their permissions. They never copy the permissions of the login on other server securables (Server.EnumObjectPermissions):

  • logins and server roles (class 101): IMPERSONATE ON LOGIN::x, CONTROL/ALTER/VIEW DEFINITION ON LOGIN::x or ON SERVER ROLE::x
  • endpoints (class 105): CONNECT ON ENDPOINT::x
  • availability groups (class 108): ALTER/CONTROL/VIEW DEFINITION ON AVAILABILITY GROUP::x

A login copied to a new instance therefore loses, for example, the IMPERSONATE an application login needs for EXECUTE AS LOGIN. Since #10801, an existing login that -UpdateExisting or Sync-DbaLoginPermission syncs loses the class 101 permissions that the source login does not have, but it gets none that the source login has.

Proposal:

  1. Copy the class 101 permissions of the source login whose securable exists on the destination (with a rename, the securable is matched by name, the grantee is the new login). A missing securable gives a verbose message, not a failure.
  2. Leave endpoints and availability groups out by default. They belong to the replica: a secondary grants CONNECT on its endpoint to the service account of the primary, and endpoint names may differ per replica. A switch could copy them where the names match.
  3. Script the same permissions in Export-DbaLogin.

Is this wanted, and should 2 be a switch or left out entirely?


This text was created by Claude and reviewed by Andreas Jordan.

主要语言
PowerShell
星标
2.9k
派生
869
平均合并
2 天 4 小时
30 天内合并 PR
38

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dataplat/dbatools 的其他 Issue

查看 dataplat/dbatools 的全部 Issue

相似的 Issue

更多 Databases Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。