I've been asked to write a stored procedure to restore one Azure SQL database from the current copy of a different database. Up until now I've been achieving this with Powershell, as such:
# Restore database from latest geo-redundant backup into existing server
$GeoBackup = Get-AzureRmSqlDatabaseGeoBackup -ResourceGroupName "Search_Group1" -ServerName "DataT" -DatabaseName "db_master"
Restore-AzureRmSqlDatabase -FromGeoBackup `
-ResourceGroupName "Search_Group1" `
-ServerName "DataT" `
-TargetDatabaseName "db_search" `
-ResourceId $GeoBackup.ResourceID `
-Edition "Standard" `
-ServiceObjectiveName "S3"
So in the above, we take our existing database called db_master, and use it's latest backup to create an exact copy called db_search.
Is is possible to create a stored procedure that does this? I was attempting to use the Restore Database UI inside SSMS from which I could then script to T-SQL, but the option to Restore in SSMS is not even present for Azure SQL databases.