Hi, I'm not the only one wanting to do this I'm sure.
We have two subscriptions in Azure, one for production and the other for "Dev/Test". The Dev/Test subscription has a much more favorable costing environment than the production counter part.
What we would like to do as part of our DevOps practices is move a copy of our production databases to our Dev/Test subscription in a DevOps pipeline. Currently we have a weekly job to copy production data to a "Development" server in the same production subscription. We accomplish this with a short script mainly focused around the PS command New-AzSqlDatabaseCopy. In this script it calls for a few parameters, none of which are a subscription ID.
$resultCopy = New-AzSqlDatabaseCopy `
-ResourceGroupName "$sourceResourceGroup" `
-ServerName "$sourceServer" `
-DatabaseName "$sourceDbName" `
-CopyResourceGroupName "$targetResourceGroup" `
-CopyServerName "$targetServer" `
-CopyDatabaseName $dbCopyName `
-ElasticPool "$targetElasticPool"
Reading MS documentation there is no way to do this type of copy with this command. I have seen some TSQL solutions but they do no look very graceful at all.
How have you others managed to move SQL Databases from one subscription to another in your pipelines? Are there DevOps Marketplace tools to do this for me in which I have not yet discovered?
Your Expert help is appreciated.
Thanks in advance.