Changes for page DR Pipelines

Last modified by Nikhil Singh on 2026/07/03 08:27

<
From version < 3.1 >
edited by Nikhil Singh
on 2026/01/23 10:27
To version < 2.1 >
edited by Nikhil Singh
on 2025/10/17 07:45
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -DR PIPELINES
1 +SQLMI-Restore-Automation-DR
Content
... ... @@ -1,37 +1,34 @@
1 -==== 1. Managed Instance Restore ====
1 +=== Script Overview: ===
2 2  
3 -Pipeline: [[https:~~/~~/dev.azure.com/ebsphere/ebsphere/_build?definitionId=17>>https://dev.azure.com/ebsphere/ebsphere/_build?definitionId=17]]
3 +The PowerShell script automates the following key steps to perform a geo-restore of a managed instance database from the production SQLMI to the DR SQLMI, including handling the Managed Instance storage scaling, restore verification, and cleanup.
4 4  
5 -This pipeline restores one or more databases from a source Azure SQL Managed Instance to a target Managed Instance, primarily for disaster recovery scenarios. It supports geo-restore, optional Start/stop, storage resizing (upscale/downscale), Deletion of restored databases, Pre-Delete (checks if database exists first and then deletes to allow restore) . Databases can be selected individually or via wildcard filters (for example, *Live*), and the pipeline produces a detailed execution report published to both Azure DevOps artifacts and Azure Blob Storage.
6 6  
6 +=== Script Breakdown ===
7 7  
8 -==== 2. Managed Instance Object Migration ====
8 +1. **Set Variables:**
9 +Define Azure subscription, resource group, Managed Instance names, database names, storage sizes, and logging locations.
10 +1. **Initialize Logs:**
11 +Create log folder if it doesn’t exist.
12 +1. **Connect to Azure:**
13 +Login and set the subscription context.
14 +1. **Start Managed Instance:**
15 +Check if the DR Managed Instance is running; start it if stopped.
16 +1. **Increase Storage Size:**
17 +Temporarily increase storage to allow room for the database restore.
18 +1. **Restore Database:**
19 +Perform a geo-restore of the production database to the DR Managed Instance.
20 +1. **Wait for Restore to Complete:**
21 +Monitor until the restored database is online.
22 +1. **Delete Restored Database:**
23 +Remove the restored database to clean up space
24 +1. **Reduce Storage Size:**
25 +Scale storage back down to the original minimal size.
26 +1. **Stop Managed Instance:**
27 +Shut down the Managed Instance to save costs.
28 +1. **Write Logs and Upload:**
29 +Save detailed logs and a summary report, then upload them to Azure Blob Storage.
9 9  
10 -Pipeline: [[https:~~/~~/dev.azure.com/ebsphere/ebsphere/_build?definitionId=23>>https://dev.azure.com/ebsphere/ebsphere/_build?definitionId=23]]
11 11  
12 -This pipeline migrates server-level and database-level objects between Azure SQL Managed Instances, including logins, triggers, and schedules. It uses dbatools to selectively migrate objects based on filters or run all supported object types in a single execution. The pipeline supports wildcard-based login selection, exclusion lists, verbose logging, and controlled execution through flags, and publishes detailed migration output as Azure DevOps build artifacts.
32 +Script: [[https:~~/~~/dev.azure.com/ebsphere/ebsphere/_git/devops?path=/devops/sql/AzMI-Grr.ps1&version=GBfeature/ebs/mi-dr-check>>https://dev.azure.com/ebsphere/ebsphere/_git/devops?path=/devops/sql/AzMI-Grr.ps1&version=GBfeature/ebs/mi-dr-check]]
13 13  
14 -==== ====
15 -
16 -==== 3. Extract DB Objects ====
17 -
18 -Pipeline: [[https:~~/~~/dev.azure.com/ebsphere/ebsphere/_build?definitionId=28>>https://dev.azure.com/ebsphere/ebsphere/_build?definitionId=28]]
19 -
20 -This pipeline exports selected server-level and database-related objects from a source Azure SQL Managed Instance, including logins, triggers, schedules, agent jobs, and server roles. It uses dbatools to selectively extract individual object types or all supported objects in a single run, with optional verbose logging. The extracted objects are packaged and published to Blob Storage and as Azure DevOps build artifacts for later review or deployment.
21 -
22 -
23 -==== 4. Deploy DB Objects ====
24 -
25 -Pipeline: [[https:~~/~~/dev.azure.com/ebsphere/ebsphere/_build?definitionId=29>>https://dev.azure.com/ebsphere/ebsphere/_build?definitionId=29]]
26 -
27 -The **Deploy DB Objects** pipeline deploys previously extracted SQL Managed Instance objects to a target Managed Instance using artifacts stored in Azure Blob Storage. It supports selective deployment through wildcard filters, optional verbose logging, and handles objects such as agent jobs and related server-level components. The pipeline authenticates to Azure, retrieves the specified object set, applies it to the target instance, and publishes deployment results as Azure DevOps build artifacts.
28 -
29 -
30 -==== 5. Stop Managed Instance ====
31 -
32 -Pipeline: [[https:~~/~~/dev.azure.com/ebsphere/ebsphere/_build?definitionId=30>>https://dev.azure.com/ebsphere/ebsphere/_build?definitionId=30]]
33 -
34 -The **Stop Managed Instance (DR)** pipeline automatically stops the designated disaster recovery Azure SQL Managed Instance on a scheduled basis to reduce operational costs when the instance is not in use. It authenticates to Azure using a service connection, executes a PowerShell script to stop the target Managed Instance. Pipeline is scheduled for 6 pm every day.
35 -
36 -
37 -=== ===
34 +(example in the script on how to use)

Need help?

If you need help with XWiki you can contact: