Home
%3CLINGO-SUB%20id%3D%22lingo-sub-1043570%22%20slang%3D%22en-US%22%3ERestore%20your%20Azure%20Database%20for%20MySQL%20server%20into%20a%20different%20Azure%20subscription%2C%20the%20right%20way%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1043570%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20you%20are%20working%20on%20Azure%2C%20as%20a%20standard%20practice%20for%20governance%20and%20security%2C%20your%20cloud%20team%20may%20require%20you%20to%20create%20and%20maintain%20separate%20Azure%20subscriptions%20for%20production%2C%20development%2C%20and%20test%20environments.%20Separate%20Azure%20subscriptions%20provide%20optimal%20isolation%20and%20control%20between%20environments%20to%20ensure%20that%20administrators%20or%20operations%20team%20members%20restrict%20access%20to%20production%20environments%20while%20developers%20get%20the%20freedom%20to%20create%2C%20delete%2C%20and%20break%20things%20at%20their%20will%20in%20their%20own%20contained%20environment%20without%20any%20risk%20of%20impacting%20production.%20This%20strategy%20works%20very%20well%20and%20is%20widely%20adopted%20by%20Azure%20customers.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20challenge%20our%20customers%20often%20encounter%20with%20this%20approach%20is%20the%20inability%20to%20restore%20production%20databases%20in%20different%20Azure%20subscription.%20Restoring%20production%20database%20on%20developer%20subscriptions%20may%20be%20required%20for%20troubleshooting%20production%20issues%20or%20simulating%20a%20production-like%20environment%20in%20testing.%26nbsp%3BMost%20Azure%20data%20services%2C%20including%20Azure%20Database%20for%20MySQL%2C%20don%E2%80%99t%20allow%20for%20restoring%20database%20backups%20across%20Azure%20subscriptions.%20This%20is%20an%20intentional%20choice%20made%20by%20our%20engineering%20team%20to%20ensure%20data%20security%2C%20as%20subscriptions%20are%20strongly%20honored%20as%20tenant%20boundary.%20To%20address%20this%2C%20many%20of%20our%20customers%20rely%20on%20logical%20backup%20solutions%20such%20as%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fconcepts-migrate-dump-restore%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Emysqldump%3C%2FA%3E%20to%20extract%20data%20from%20%26nbsp%3Ba%20production%20server%20and%20restore%20it%20in%20the%20developer%20environment%2C%20but%20the%20process%20is%20time-%20and%20resource-intensive%2C%20and%20it%20cannot%20scale.%20The%20good%20news%20is%20that%20there%20is%20better%20way%20to%20accomplish%20this%20that%20can%20save%20you%20time%20and%20additional%20compute%20resources%20as%20you%20leverage%20built%20in%20automatic%20backups%20and%20resource%20movement%20across%20subscriptions.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20achieve%20this%2C%20you%20can%20use%20the%20following%20process.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CSTRONG%3EPerform%20a%20Point-in-time%20Restore%20of%20the%20server%20in%20the%20same%20Azure%20subscription%3C%2FSTRONG%3E%20%E2%80%93%20You%20can%20restore%20from%20the%20automatic%20backups%20of%20the%20production%20server%20in%20the%20same%20Azure%20subscription%20but%20in%20a%20separate%20resource%20group%20by%20using%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fhowto-restore-server-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20portal%3C%2FA%3E%20or%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fhowto-restore-server-cli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20CLI%3C%2FA%3E.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EPrepare%20the%20restored%20server%20for%20developer%20access%3C%2FSTRONG%3E%20%E2%80%93%20Your%20production%20database%20may%20contain%20sensitive%20customer%20information%20or%20business%20data%20that%20for%20security%20reasons%20you%20may%20not%20want%20to%20expose%20to%20developers.%20In%20this%20scenario%2C%20you%20can%20run%20your%20custom%20data%20masking%20script%20on%20the%20restored%20database%20to%20delete%2C%20hide%2C%20or%20obfuscate%20sensitive%20data.%20In%20addition%2C%20the%20production%20server%20may%20not%20have%20developer%20logins%2C%20so%20you%20may%20want%20to%20create%20logins%20to%20allow%20developers%20to%20connect%20to%20the%20restored%20server%20and%20delete%20any%20unwanted%20logins%20that%20may%20not%20need%20access%20to%20this%20server.%20In%20summary%2C%20in%20this%20step%2C%20you%20would%20prepare%20the%20server%20before%20opening%20it%20for%20developer%20access.%20While%20this%20step%20is%20recommended%20it%20may%20not%20be%20generally%20required%20and%20can%20be%20omitted.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EMove%20the%20restored%20Azure%20Database%20for%20MySQL%20server%20to%20developer%20subscriptions%26nbsp%3B%3C%2FSTRONG%3E%E2%80%93%20Azure%20Resource%20Manager%20(ARM)%20allows%20you%20to%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Fresource-group-move-resources%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Emove%20resources%20to%20a%20new%20subscription%20or%20resource%20group%3C%2FA%3E.%20You%20can%20leverage%20this%20feature%20to%20move%20the%20restored%20Azure%20Database%20for%20MySQL%20server%20to%20your%20intended%20Azure%20subscription%20using%20the%20interface%20shown%20below%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20626px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F159718iED1F8FD4E6B40FB1%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAfter%20you%20complete%20the%20move%20of%20restored%20server%2C%20the%20server%20will%20be%20ready%20and%20available%20for%20developers%E2%80%99%20use.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhile%20using%20this%20approach%20might%20require%20a%20few%20additional%20steps%2C%20it%20helps%20to%20provide%20an%20additional%20layer%20of%20security%20and%20governance%20than%20do%20providing%20production%20access%20to%20your%20developers.%20You%20can%20also%20script%20the%20additional%20steps%20using%20Azure%20CLI%20if%20this%20a%20recurring%20operation%20in%20your%20environment%20and%20you%20periodically%20need%20to%20restore%20your%20production%20databases%20in%20developer%20environments.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20hope%20you%20find%20this%20approach%20useful%20should%20you%20have%20to%20go%20through%20this%20drill!!!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1441307020%22%20id%3D%22toc-hId--1441307020%22%3EAcknowledgments%3C%2FH2%3E%0A%3CP%3ESpecial%20thanks%20to%20Sundeep%20Kambhampati%2C%20Sunil%20Agarwal%2C%20and%20Jim%20Toland%20for%20their%20contributions%20to%20this%20posting.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EParikshit%20Savjani%3CBR%20%2F%3EPrincipal%20Program%20Manager%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1043570%22%20slang%3D%22en-US%22%3E%3CP%3EA%20challenge%20our%20customers%20often%20encounter%20is%20the%20inability%20to%20restore%20production%20databases%20in%20different%20Azure%20subscription.%20In%20this%20blog%20post%2C%20you%20will%20see%20how%20you%20can%20overcome%20that%20challenge%20and%20what%20is%20the%20right%20way%20to%20restore%20an%20Azure%20Database%20for%20MySQL%20server%20in%20a%20different%20Azure%20subscription.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1043570%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Ebackup%20and%20restore%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E

If you are working on Azure, as a standard practice for governance and security, your cloud team may require you to create and maintain separate Azure subscriptions for production, development, and test environments. Separate Azure subscriptions provide optimal isolation and control between environments to ensure that administrators or operations team members restrict access to production environments while developers get the freedom to create, delete, and break things at their will in their own contained environment without any risk of impacting production. This strategy works very well and is widely adopted by Azure customers.

 

A challenge our customers often encounter with this approach is the inability to restore production databases in different Azure subscription. Restoring production database on developer subscriptions may be required for troubleshooting production issues or simulating a production-like environment in testing. Most Azure data services, including Azure Database for MySQL, don’t allow for restoring database backups across Azure subscriptions. This is an intentional choice made by our engineering team to ensure data security, as subscriptions are strongly honored as tenant boundary. To address this, many of our customers rely on logical backup solutions such as mysqldump to extract data from  a production server and restore it in the developer environment, but the process is time- and resource-intensive, and it cannot scale. The good news is that there is better way to accomplish this that can save you time and additional compute resources as you leverage built in automatic backups and resource movement across subscriptions.

 

To achieve this, you can use the following process.

 

  1. Perform a Point-in-time Restore of the server in the same Azure subscription – You can restore from the automatic backups of the production server in the same Azure subscription but in a separate resource group by using the Azure portal or Azure CLI.
  2. Prepare the restored server for developer access – Your production database may contain sensitive customer information or business data that for security reasons you may not want to expose to developers. In this scenario, you can run your custom data masking script on the restored database to delete, hide, or obfuscate sensitive data. In addition, the production server may not have developer logins, so you may want to create logins to allow developers to connect to the restored server and delete any unwanted logins that may not need access to this server. In summary, in this step, you would prepare the server before opening it for developer access. While this step is recommended it may not be generally required and can be omitted.
  3. Move the restored Azure Database for MySQL server to developer subscriptions – Azure Resource Manager (ARM) allows you to move resources to a new subscription or resource group. You can leverage this feature to move the restored Azure Database for MySQL server to your intended Azure subscription using the interface shown below:

    clipboard_image_0.png

 

After you complete the move of restored server, the server will be ready and available for developers’ use.

 

While using this approach might require a few additional steps, it helps to provide an additional layer of security and governance than do providing production access to your developers. You can also script the additional steps using Azure CLI if this a recurring operation in your environment and you periodically need to restore your production databases in developer environments.

 

We hope you find this approach useful should you have to go through this drill!!!

 

Acknowledgments

Special thanks to Sundeep Kambhampati, Sunil Agarwal, and Jim Toland for their contributions to this posting.

 

Parikshit Savjani
Principal Program Manager