we split our testing , production instances in windows azure 2 separate subscriptions. have 3 windows azure sql database instances reside within same subscription:
- production
- reporting
- testing
in order isolate production splitting these into:
- production subscription
- production
- reporting
- testing subscription
- testing
at moment use create database x copy of [servername].y command copy databases production testing before obfuscate live data. operation can performed long databases geo-located in same data centre , have shared login across instances created database in first place (as indicated article).
however; article not indicate whether source , destination instance need belong same subscription. able copy database between production subscription , testing subscription (and vica verca) assuming use consistent login?
i guess have solution, landing here, can use azure powershell api's create new server in source subscription, create copy , switch on new server destination server
sample code available on technet
the code self explanatory, in interest of best practices,
key portions of code are
create new server:
$newserver = new-azuresqldatabaseserver -location $targetserverlocation -administratorlogin $targetserverloginid -administratorloginpassword $targetserverloginpassword create database copy:
start-azuresqldatabasecopy -servername $sourceservername -databasename $sourcedatabasename -partnerserver $newserver.servername -partnerdatabase $targetdatabasename transfer server
$uri = "https://management.core.windows.net:8443/" + $sourcesubscriptionid + "/services" + "/sqlservers/servers/" + $newserver.servername + "?op=changesubscription" invoke-restmethod -uri $uri -certificatethumbprint $certthumbprint -contenttype $contenttype -method $method -headers $headers -body $body
Comments
Post a Comment