i'm using Azure SQL. In Azure Portal, i was create 1 Azure SQL Server (with username login user01
) and 2 Azure SQL Database (ExDatabase1
and ExDatabase2
) inside it.
In Microsoft SQL server management studio
tool, i'm login success with user user01
. i'm using transparent data encryption (TDE) and try create Database Master Key for master database
with command bellow:
USE master;
Go
CREATE MASTER KEY ENCRYPTION by PASSWORD = 'Strongp@ssw0rd';
Go
But, i received error:
Msg 15247, Level 16, State 1, Line 3
User does not have permission to perform this action.
So, what is permission for this current user (this is owner database)? and how to do that?. thanks!
USE statement is not supported to switch between databases. Use a new connection to connect to a different database on Azure SQL Database.
To create a master key in Azure SQL just run the following statement on the Azure SQL Database context not on the master database.
CREATE MASTER KEY
GO
For a full example please read this article.
Another example can be found here.
CREATE MASTER KEY ENCRYPTION BY PASSWORD='MyPassw0rdIsComplex.'
GO