I've created azure database using powershell. Now i want to rename the database using powershell. My purpose to do this is creating temporary database, then deploy database release to temp DB,then rename production db to any other name, finaly rename Temp Db to production db
2 Answers
To achieve this, you can use the cmdlet "Set-AzureSqlDatabase", the parameter "-NewDatabaseName" permits to set a new name for a specified database name.
Set-AzureSqlDatabase -ServerName 'myservername' -DatabaseName 'mydb' -NewDatabaseName 'newNameForTheDb'
Here is the documentation : https://msdn.microsoft.com/fr-fr/library/dn546732.aspx
2 Comments
Simon Zeinstra
If you want to use an AzureRM command, use the following syntax: Set-AzureRMSqlDatabase -ResourceGroupName $ResourceGroupName -ServerName $SQLServerName -DatabaseName $DatabaseName -NewName $NewDatabaseName
Asher
Command is outdated. It is now: Set-AzSqlDatabase. Also NewDatabaseName is now -NewName