Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6577425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:38:02+00:00 2026-05-25T15:38:02+00:00

Just reading this link: http://msdn.microsoft.com/en-us/library/aa833199.aspx It states: You cannot add users to roles in

  • 0

Just reading this link:

http://msdn.microsoft.com/en-us/library/aa833199.aspx

It states: You cannot add users to roles in a Data-tier Application (DAC) project because DAC projects do not support the EXEC StoredProcedure construct, except within the body of an object, such as a stored procedure or function. For more information, see the following page on the Microsoft Web site: Features Supported in Data-tier Applications.

So, how is it possible to grant any permission to anything as part of the deployment?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:38:03+00:00Added an answer on May 25, 2026 at 3:38 pm

    After much digging and hacking, I finally have a solution.

    A few notes first:

    • the solution works on a brand-new DAC or an already-deployed DAC you are updating
    • my setup is VS10ult run on Win7x64 deploying to SQL Server 2008 R2 hosted in Server 2008 R2
    • all my deployment was done from VS10 — neither SSMS or the DAC PowerShell Scripts were able to deploy the DAC (both were attempted locally on the server)
    • as well, SSMS was unable to uninstall a DAC from the SQL Server Instance, but the DAC PS Scripts were able to (I included my locally-run PS script in the Footnote at the bottom)
    • the user that deploys/installs the DAC will get their login mapped to the db’s dbo user’s Login name

    To add a given domain user as a server login and db user with specific permissions:

    Step 1: create a Login

    • open the Data-Tier Application VS10 project
    • right-click the folder Schema Objects / Server Level Objects / Security / Logins
    • click Add then New Item
    • select the template Database Project / Security
    • select Login (Windows Auth)
    • hit <TAB> or click the Name textbox
    • type the bare login name (eg: for DOMAIN\USER just enter USER) and hit <Enter>
    • enter this for your code then save and close the file (USER.login.sql)

      create login [DOMAIN\USER] from windows
      

    Step 2: create a User

    • right-click the folder Schema Objects / Database Level Level Objects / Security / Users
    • click Add then New Item
    • select the template Database Project / Security
    • select User
    • hit <TAB> or click the Name textbox
    • type the bare user name (eg: for DOMAIN\USER just enter USER) and hit <Enter>
    • enter this for your code then save and close the file (USER.user.sql)

      create user [USER]
         for login [DOMAIN\USER]
         with default_schema = dbo;
      

    Step 3: grant the privileges on the user and/or login

    • right-click the folder Scripts / Post-Deployment
    • open the file Script.PostDeployment.sql for editing
    • enter this for your code then save and close the file

      alter login [DOMAIN\USER] enable
      go
      
      use [DAC-DB-NAME];
      
      exec sp_addrolemember db_owner, [USER]
      go
      
    • note that a set of grant statements can be substituted for the sp_addrolemember

    Ultimately, I think the real difficulty in doing this was how the post-deployment script is run. When run, the current Use database is initially set to master, but in order to issue the exec sp_addrolemember and/or grants, the use [DAC-DB-NAME]; must set the current database first. [End of pure speculation]

    Happy Coding!
    Robert McCall
    “Lasting peace & happiness for ALL human beings!”


    Footnote: PowerShell script (using DAC PS Scripts) to uninstall & drop a DAC db

    # *MUST* BE RUN AS Administrator
    # Need extra line after next line to select the default 'Yes'
    Set-ExecutionPolicy RemoteSigned
    
    Import-Module DACModule
    
    $svrName = "SERVER-NAME"
    $dacName = "DAC-DB-NAME"
    
    $svrCon = New-Object Microsoft.SqlServer.Management.Common.ServerConnection $svrName
    $svrCon.Connect()
    
    Uninstall-Dac -serverConnection $svrCon -dacInstanceName $dacName -uninstallMode DropDatabase
    
    $svrCon.Disconnect()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

just was reading this article http://highscalability.com/blog/2010/3/23/digg-4000-performance-increase-by-sorting-in-php-rather-than.html And found this nice article http://wiki.apache.org/cassandra/DataModel I just
Just finished reading this blog post: http://www.skorks.com/2010/03/an-interview-question-that-prints-out-its-own-source-code-in-ruby/ In it, the author argues the case
I just finished reading this post: https://developer.yahoo.com/performance/rules.html#flush and have already implemented a flush after
Am just started reading view tutorial i used this link view tutorial in this
I was reading this link http://dec.bournemouth.ac.uk/staff/awatson/micro/articles/9907feat2.htm I could not understand this following statements from
I was just reading this thread and it occurred to me that there is
I was just reading this line: The first thing the format() method does is
I was just reading this article and it mentions that some organization had an
I just finished reading this article on the advantages and disadvantages of exceptions and
Just trying to get my head around Generics by reading this enlightening article by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.