locked
Syntax for encryption...CREATE MASTER KEY = '$(master_key)' RRS feed

  • Question

  • Hi Folks - I'm trying to understand code that specifies:

    CREATE MASTER KEY ENCRYPTION BY PASSWORD = '$(master_key)'

    Here, instead of a random string password, '$(master_key)' is used.  What does that variable mean, the $ and the tic marks? I'll guess $ is a parameter reference, tics make it a string?  Where is master_key from?

    Thanks!

    Thursday, December 27, 2012 5:25 AM

Answers

  • Hello,

    The “$(master_key)“ is the password that is used to encrypt the master key in the database. When encrypted the key, the password must meet the Windows password policy requirements of the computer that is running the instance of SQL Server.
    For more information, please refer to the article as Anuragsh post above.

    Regards,
    Fanny Liu


    Fanny Liu
    TechNet Community Support

    Friday, December 28, 2012 3:26 AM
  • Hi,

    $(master_key) is all used as string the $ is just like any character, As you now it is better to make complicated password (hard to guess).

    I hope this is helpful.


    Please Mark it as Answered if it answered your question
    OR mark it as Helpful if it help you to solve your problem
    Elmozamil Elamir Hamid

    MCTS: SQL Server Administration/Development

    MyBlog

    • Proposed as answer by Fanny Liu Friday, December 28, 2012 3:20 AM
    • Marked as answer by Allen Li - MSFT Wednesday, January 2, 2013 1:23 AM
    Thursday, December 27, 2012 6:02 AM
  • CREATE MASTER KEY (Transact-SQL)

    Please use Marked as Answer if my post solved your problem and use Vote As Helpful, if a post was useful to help other user's find a solution quicker.

    • Proposed as answer by Fanny Liu Friday, December 28, 2012 3:21 AM
    • Marked as answer by Allen Li - MSFT Wednesday, January 2, 2013 1:23 AM
    Thursday, December 27, 2012 8:37 AM

All replies

  • Hi,

    $(master_key) is all used as string the $ is just like any character, As you now it is better to make complicated password (hard to guess).

    I hope this is helpful.


    Please Mark it as Answered if it answered your question
    OR mark it as Helpful if it help you to solve your problem
    Elmozamil Elamir Hamid

    MCTS: SQL Server Administration/Development

    MyBlog

    • Proposed as answer by Fanny Liu Friday, December 28, 2012 3:20 AM
    • Marked as answer by Allen Li - MSFT Wednesday, January 2, 2013 1:23 AM
    Thursday, December 27, 2012 6:02 AM
  • CREATE MASTER KEY (Transact-SQL)

    Please use Marked as Answer if my post solved your problem and use Vote As Helpful, if a post was useful to help other user's find a solution quicker.

    • Proposed as answer by Fanny Liu Friday, December 28, 2012 3:21 AM
    • Marked as answer by Allen Li - MSFT Wednesday, January 2, 2013 1:23 AM
    Thursday, December 27, 2012 8:37 AM
  • Looks like it's part of a script that is meant to be run by SQLCMD or in SQLCMD mode. $(master_key) is a variable you would set on the command line, or earlier in the script with the :setvar command. The entry for SQLCMD in Books Online has more information.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Thursday, December 27, 2012 8:48 AM
  • Hello,

    The “$(master_key)“ is the password that is used to encrypt the master key in the database. When encrypted the key, the password must meet the Windows password policy requirements of the computer that is running the instance of SQL Server.
    For more information, please refer to the article as Anuragsh post above.

    Regards,
    Fanny Liu


    Fanny Liu
    TechNet Community Support

    Friday, December 28, 2012 3:26 AM