{"id":10380,"date":"2021-07-16T16:43:12","date_gmt":"2021-07-16T21:43:12","guid":{"rendered":"https:\/\/threecloud.wpengine.com\/post\/moving-azure-sql-database-from-one-subscription-to-another\/"},"modified":"2022-11-30T09:23:51","modified_gmt":"2022-11-30T15:23:51","slug":"moving-azure-sql-database-from-one-subscription-to-another","status":"publish","type":"post","link":"https:\/\/3cloudsolutions.com\/resources\/moving-azure-sql-database-from-one-subscription-to-another\/","title":{"rendered":"Moving Azure SQL Database from One Subscription to Another"},"content":{"rendered":"<h3><strong>Multiple Environments<\/strong><\/h3>\n<p>Many companies like to separate Production from Development \/ UAT environments. I have frequently seen Dev \/ UAT deployed to one subscription, and Production to a different subscription. This works well for the Finance team because the billing for each environment is separated. However, having the environments in different subscriptions inserts a speed bump in a common practice among DBAs \u2013 restoring a copy of the Production database in the UAT and Dev environments to ensure that code is synchronized across all environments.<\/p>\n<h3><strong>Azure SQL Database Restore Database\u00a0<\/strong><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-5821 aligncenter\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/image-1-300x84.png\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" srcset=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/image-1-300x84.png 300w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/image-1.png 640w\" alt=\"\" width=\"525\" height=\"147\" \/><\/p>\n<p>In Azure SQL Database, when you select \u201cRestore\u201d, your options are limited to restoring the same server. Notice that the options for changing the subscription, resource group, and server are greyed out. Only the database name can be changed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-5825 aligncenter\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture2-278x300.png\" sizes=\"auto, (max-width: 297px) 100vw, 297px\" srcset=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture2-278x300.png 278w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture2.png 592w\" alt=\"\" width=\"297\" height=\"320\" \/><\/p>\n<p>If you need to restore a copy of your Azure SQL database on the same server so that you can copy a deleted table back into your database, then this works fine.<\/p>\n<p>The restore Azure SQL database operation will not allow restoring the database over the existing database, however, you can change the name of the database at any time.<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>Rename Azure SQL Database<\/strong><\/h3>\n<p>In SQL Server Management Studio run the following command on your Azure SQL Server:<\/p>\n<p>ALTER DATABASE OriginalDatabaseName MODIFY NAME = NewDatabaseName;<\/p>\n<p>&nbsp;<\/p>\n<h3><strong>Azure SQL Database Copy Database<\/strong><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-5824 aligncenter\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture33-300x67.png\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" srcset=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture33-300x67.png 300w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture33.png 640w\" alt=\"\" width=\"502\" height=\"112\" \/><\/p>\n<p>The next option would be to COPY the database. This option looks promising because it allows the database to be copied to another server, and if a different Azure SQL server does not exist, a new one may be created without having to leave the Copy dialog and create one separately.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-5823 aligncenter\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture4-287x300.png\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" srcset=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture4-287x300.png 287w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture4.png 613w\" alt=\"\" width=\"326\" height=\"341\" \/><\/p>\n<p>Although the New Server option looks promising, it does not provide the desired options: changing the subscription and resource group.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-5822 aligncenter\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture5-215x300.png\" sizes=\"auto, (max-width: 235px) 100vw, 235px\" srcset=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture5-215x300.png 215w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture5.png 287w\" alt=\"\" width=\"235\" height=\"328\" \/><\/p>\n<p>All is not lost, a solution exists: since an Azure SQL Server can move from one Subscription to another, the database can be copied to a Migration server, moved to the other Subscription then copied onto the existing server to refresh the existing database.<\/p>\n<h3><strong>It\u2019s Easier than It Sounds<\/strong><\/h3>\n<p>You must have at least Contributor rights in both subscriptions to successfully perform this operation.<\/p>\n<ul>\n<li>Copy the Azure SQL Database to a new migration Azure SQL server using the \u201cCopy database\u201d blade as shown above. This server will exist only for the duration of the database transfer and can be deleted immediately following the completion of the process<\/li>\n<li>Go to the Migration Azure SQL Server\u2019s Overview page<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-5829 aligncenter\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture6-300x63.png\" sizes=\"auto, (max-width: 424px) 100vw, 424px\" srcset=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture6-300x63.png 300w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture6.png 400w\" alt=\"\" width=\"424\" height=\"89\" \/><\/p>\n<ul>\n<li>Click on \u201cMove\u201d and select \u201cMove to another subscription\u201d in the drop list<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-5828 aligncenter\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture7-300x199.png\" sizes=\"auto, (max-width: 385px) 100vw, 385px\" srcset=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture7-300x199.png 300w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture7.png 391w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture7.png 640w\" alt=\"\" width=\"385\" height=\"255\" \/><\/p>\n<p>In the above example, the user does not have access to move resources to the selected resource group.<\/p>\n<ul>\n<li>With appropriate permissions, the next step is the validation of resources to move<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-5827 aligncenter\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture8-300x177.png\" sizes=\"auto, (max-width: 477px) 100vw, 477px\" srcset=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture8-300x177.png 300w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture8.png 640w\" alt=\"\" width=\"477\" height=\"281\" \/><\/p>\n<p>(The above image is linked to the image in Microsoft Documents \u201c<a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/azure-resource-manager\/management\/move-resource-group-and-subscription\">Move resources to a new subscription<\/a>\u201d article because my account doesn\u2019t have rights to perform this action so I cannot get a good screenshot. The validation dialog should show only the Migration Azure SQL server in this step.)<\/p>\n<ul>\n<li>Upon completion of Validation, the Review screen pops up<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-5826 aligncenter\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture9-300x192.png\" sizes=\"auto, (max-width: 408px) 100vw, 408px\" srcset=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture9-300x192.png 300w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2021\/09\/Picture9.png 640w\" alt=\"\" width=\"408\" height=\"261\" \/><\/p>\n<ul>\n<li>Confirm Source and Target subscriptions, resource groups, and several resources to move then check the box and click \u201cMove\u201d<\/li>\n<li>Azure will pop up a notification when the move has been completed<\/li>\n<li>Go to the subscription and resource group where the Migration server has moved<\/li>\n<li>Go to the overview page of your Azure SQL Database on the Migration server<\/li>\n<li>Click on \u201cCopy\u201d<\/li>\n<li>Select your UAT or Dev Azure SQL Server and set the database name<\/li>\n<li>Click on \u201cReview + Create\u201d<\/li>\n<li>Click on \u201cCreate\u201d to complete the process<\/li>\n<\/ul>\n<p>Upon successful completion of the deployment, the migration server may be deleted.<\/p>\n<p>If you have questions about Azure SQL Database, either how to use it or how to implement it in your organization, reach out to us. Our expert team and solution offerings can help your business with any Azure product or service, including Managed Services offerings. Contact us at 888-8AZURE or\u00a0 <a href=\"mailto:sales@3cloudsolutions.com\">sales@3cloudsolutions.com<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Multiple Environments Many companies like to separate Production from Development \/ UAT environments. I have&mldr;<\/p>\n","protected":false},"author":33,"featured_media":10708,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[260],"tags":[],"class_list":["post-10380","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-ai","topics-blog"],"acf":[],"_links":{"self":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts\/10380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/users\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/comments?post=10380"}],"version-history":[{"count":0,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts\/10380\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/media\/10708"}],"wp:attachment":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/media?parent=10380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/categories?post=10380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/tags?post=10380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}