Nathan Dixon
Nathan Dixon

Reputation: 63

How do you change the owner of an Azure database

I'm trying to make a copy of a database in Azure. This requires that the user logged in be the db_owner of the database.

Unfortunately the person who created the database has left and we don't have their login credentials and they don't remember them either.

Is there any way to change the db_owner in Azure databases?

Note: Doing EXEC sp_addrolemember 'db_owner', 'login1User' doesn't work for this as the actual owner account is needed to copy a database in Azure.

Upvotes: 4

Views: 9200

Answers (3)

Rob Varga
Rob Varga

Reputation: 71

ALTER AUTHORIZATION ON DATABASE::<YourDatabaseName> to [NewOwner];

Upvotes: 6

Peter Ritchie
Peter Ritchie

Reputation: 35870

You probably want to reset the password on the server (not the database). When you click on "SQL Databases" tab on the portal, you'll go to a list of your databases. On there there will be a "Server" column. The entries in that column are hyperlinks. Click on the server you don't know the password for. on the Dashboard page for the server for the SQL Database you'll see a "Reset Administrator Password" link on the right under "quick glance".

Once you do that you can log into the management console for the database and change the logins for the database with ALTER LOGIN

Upvotes: 2

richstep
richstep

Reputation: 304

To my knowledge there is no way to do this. Try looking in the former employees code for connections strings and hardcoded passwords.

You can also review this guide to see if there are any commands that may help you: Managing Databases and Logins in Windows Azure SQL Database

Upvotes: -1

Related Questions