locked
VS2010 Granting Impersonate permissions in Master.sqlpermissions fails due to unresolved reference error RRS feed

  • General discussion

  • In Visual Studio 2010 I have a solution with a database and a server project.  The server project has the following under Server Level Objects\Security\Logins:

    CREATE LOGIN [TestUser1] WITH PASSWORD=N'TestUser2', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF

    CREATE LOGIN [TestUser2] WITH PASSWORD=N'TestUser2', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF


    In the Master.sqlpermissions i grant TestUser1 impersonate permission on TestUser2

      <PermissionStatement Action="GRANT">
        <Permission>IMPERSONATE</Permission>
        <Grantee>TestUser1</Grantee>
        <Object Name="TestUser2" Type="LOGIN" />
        <Grantor>TestUser2</Grantor>
      </PermissionStatement>
    </Permissions>

    However upon building the project i receive the following two errors:

    Error 1 SQL03006: Permission has an unresolved reference to object [TestUser1].
    Error 2 SQL03006: Permission has an unresolved reference to object [TestUser2].

    My work-around is to put this in the post-deployment scripts:

    USE [master]
    GRANT IMPERSONATE ON LOGIN::TestUser2 TO [TestUser1];
    GO
    • Changed type WeiLin Qiao Thursday, March 3, 2011 2:31 AM workaround sharing
    Monday, February 28, 2011 11:58 PM