Why not backup the database and restore it?
You can run a backup and restore from your web application without much difficulty. You should probably write the code to handle the backup in a stored procedure instead of trying to write the logic in your application code. Something like:
CREATE PROCEDURE dbo.InitiateClone
@DBName SYSNAME
AS
BEGIN
SET NOCOUNT ON;
DECLARE @sql NVARCHAR(MAX);
SET @sql = N'BACKUP DATABASE ' + QUOTENAME(@DBName)
+ ' TO DISK = ''\\Common_network_path\wherever\' + @DBName + '.BAK''
+ WITH INIT;';
EXEC sp_executesql @sql;
SET @sql = N'SELECT name, type_desc FROM sys.
END
GO
Now the app that asks for the backup can consume the data and log file name to pass to the procedure on the other server:
CREATE PROCEDURE dbo.FinishClone
@NewDBName SYSNAME,
@OldDBName SYSNAME,
@DataFileName VARCHAR(255),
@LogFileName VARCHAR(255)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @sql NVARCHAR(MAX);
SET @sql = N'RESTORE DATABASE ' + QUOTENAME(@NewDBName)
+ ' FROM DISK = ''\\Common_network_path\wherever\' + @OldDBName + '.BAK''
+ ' WITH MOVE ''' + @DataFileName + ''' TO ''D:\datapath\'
+ @NewDBName + '_data.mdf'','
+ ' MOVE ''' + @LogFileName + ''' TO ''D:\logpath\'
+ @NewDBName + '_log.ldf'';';
EXEC sp_executesql @sql;
END
GO
The only thing you need to worry about is if two users try to clone the same source database at the same time, so you may want to put some kind of queuing or semaphore control in there. I also omitted error handling for brevity (e.g. making sure the new name doesn't already exist). It also assumes you have simple databases (one data file and one log file). But it's a start.
EDIT since we know the destination is Azure:
With Azure I think your options are limited. I don't think you can perform a restore this way. How are you going to initiate the creation of the new database on Azure? Once that's done then you can still consider some of the third party tools for comparing and synchronizing. Red Gate's tools, for example, have command-line interfaces, which means you can certainly invoke them in response to requests from your web application.