Azure Sql Managed Instance database copy from one subscription tp another

Pardeep Singh 0 Reputation points
2023-04-06T10:25:23.11+00:00

Hi,

I have 2 subscription

  1. DEV Environment Subscription - Under this we created SQL Managed Instance which contains multiple database.
  2. PROD Environment Subscription - Created sql managed instance.

Now I want to copy the database schema/data from DEV subscription to PROD environment subscription.

E.g - DEV Subscription > Sql Managed Instance > DEV Database
Want to copy DEV database to another sql managed instance which is under different subscription.

Please suggest.

Azure SQL Database
{count} votes

3 answers

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 29,587 Reputation points Microsoft Employee Moderator
    2023-04-07T19:05:25.5133333+00:00

    Hi, @Pardeep Singh Welcome to the Microsoft Q&A forum, Thanks for posting your question. As per the document with point in time restore you can restore to a different subscription however please follow the limitation. User's image

    0 comments No comments

  2. RahulRandive 10,501 Reputation points Volunteer Moderator
    2023-04-07T19:27:07.28+00:00

    Thank you for your question. You can copy the Database using "Copy or move a database - Azure SQL Managed Instance". You can copy or move a database to another managed instance by using the Azure portal. Here is a reference document which has all the steps to perform copy operation https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/database-copy-move-how-to?view=azuresql#copy-or-move-database Let us know if you need any additional information or help. Thank you!

    0 comments No comments

  3. SSingh-MSFT 16,461 Reputation points Moderator
    2023-04-10T10:41:19.69+00:00

    Hi Pardeep Singh •,

    Welcome to Microsoft Q&A forum and thanks for using Azure Services.

    As I understand, you want Azure SQL Managed Instance (Azure SQL MI) database copy from one subscription to another.

    Currently, at this time there is no direct way to move a managed instance itself, but we can have a workaround by moving the Azure SQL managed databases across Azure SQL managed instances that are hosted\located in different subscriptions.

      You can find the below options that can be considered if you are looking to achieve this, and please make sure to take into consideration the limitations of each method as it will depend on your environment.

    1) Point-In-Time-Restore (PITR) cross subscription -> This method will allow you to restore a copy of your Azure SQL-managed databases (at some time in the past) to another Azure SQL-managed instance that is hosted on another subscription. 

      Taking into consideration that this method is restoring the managed database to another SQL-managed instance and while using this method you need to consider the limitations (such as both should be on the same region and same Tenant ID), you can check all the limitations by accessing this document.

      2) Failover groups (FoG) cross subscriptions -> by creating a failover group between your source and destination Azure SQL managed instance, this will allow you to have a replicated copy of your SQL managed database on the other subscription and once the replication is completed you can failover to the second managed instance.  

    This option is recommended in case you would like to have minimal downtime. but, also we need to check the limitations (document) as for example, the two Azure SQL-managed instances can not be on the same Azure region.    For more information:

      Note: the above options will be using different Azure SQL-managed instance names since we are moving the databases, which will require using a different Azure SQL-managed instance name.  Restore to a different subscription Restoring a point-in-time restore backup across subscriptions has the following limitations:

    • Both subscriptions must be in the same region.
    • Both subscriptions must be in the same tenant.
    • The subscription type must be either Enterprise Agreement, Cloud Solution Provider, Microsoft Certified Partner, or pay-as-you-go.
    • You can use the restore action only on the primary instance.
    • Geo-replicated backups currently aren't supported for cross-subscription point-in-time restore.
    • The user who takes the restore action must either have the SQL Managed Instance Contributor role assignment or have these explicit permissions: Microsoft.Sql/managedInstances/databases/readBackups/action on the source SQL managed instance. Microsoft.Sql/managedInstances/crossSubscriptionPITR/action on the target SQL managed instance. -If you bring your own key (BYOK), the key must be present in both subscriptions.

    Reference Doc Link: How to move Azure SQL managed instance cross subscriptions

    Cross-Subscription Failover Group - Azure SQL Managed Instance

    Hope this helps. If this answers your query, do click Accept Answer and Mark Helpful for the same. And, if you have any further query do let us know.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.