問題描述
我們有一個使用 SQL Server 身份驗證的 SQL Server,用戶可以部署,其他用戶可以閱讀,為了簡單起見,我將它們稱為部署"和網絡".
We have a SQL Server that uses SQL Server Authentication, with users that can deploy, and others that can read, for the sake of simplicity, I'll call them "deploy" and "web".
我在使用 Visual Studio (2012) 數據庫項目設置權限時遇到困難,因為部署"用戶沒有足夠的權限來創建新的服務器登錄名.
I'm having difficulty setting permissions up using a Visual Studio (2012) Database project, as the "deploy" user does not have sufficient permissions to create new server logins.
我可以添加腳本來執行以下操作:
I can add scripts to do things like:
GRANT SELECT ON foo.bar TO [web]
然后這很生氣(SQL71501:權限有一個未解析的對象 [web] 引用."),直到我添加:
This then sulks (with "SQL71501: Permission has an unresolved reference to object [web].") until I add:
CREATE USER [web] FOR LOGIN [web];
然后這很生氣(SQL71501:用戶:[web] 有一個未解析的登錄 [web] 引用."),直到我添加:
This then sulks (with "SQL71501: User: [web] has an unresolved reference to Login [web].") until I add:
CREATE LOGIN [web] WITH PASSWORD = '******';
然后無法發布:
刪除權限...
正在刪除權限...
正在創建 [webuser]...
(67,1):SQL72014:.Net SqlClient 數據提供程序:Msg 15247,級別 16,狀態 1,第 1 行用戶無權執行此操作.
(67,0): SQL72045: 腳本執行錯誤.執行的腳本:
創建登錄 [網絡用戶]
WITH PASSWORD = '**';
執行批處理時出錯.
這沒有意義,因為用戶已經存在,所以不需要創建
This doesn't make sense, as the user already exists, so shouldn't need creating
如何允許通過部署用戶發布,而無需每次都嘗試(重新)創建登錄?或者,是否可以引用外部創建的用戶,而不必發布它?
How can I allow publishing via the deployment user without trying to (re)create the login each time? Or, is it possible to reference the externally created user, without having to publish it?
推薦答案
由于用戶已經存在,我懷疑用于執行部署的用戶沒有查看它的權限.以下應該是您解決此問題所需的全部內容.
As the user already exists, I suspect that the user that is used to perform the deploy doesn't have rights to view it. The below should be all you need to resolve this.
在 LOGIN::web 上授予查看定義以進行部署
這篇關于發布 Visual Studio 數據庫項目時可以忽略登錄嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!