Code Monkey home page Code Monkey logo

rgcopy's Introduction

RGCOPY

RGCOPY (Resource Group COPY) is a tool that copies the most important resources of an Azure resource group (source RG) to a new resource group (target RG). It can copy a whole landscape consisting of many servers within a single Azure resource group to a new resource group. The target RG might be in a different region or subscription. RGCOPY has been tested on Windows, Linux and in Azure Cloud Shell. It should run on MacOS, too.

The following example demonstrates the user interface of RGCOPY

$rgcopyParameter = @{
    sourceRG        = 'sap_vmss_zone'
    targetRG        = 'sap_vmss_zone_copy'
    targetLocation  = 'eastus'
    setVmSize       = 'Standard_E4ds_v4'
    setDiskSku      = 'Premium_LRS'
}
.\rgcopy.ps1 @rgcopyParameter

"RGCOPY"

RGCOPY has been developed for copying an SAP landscape and testing Azure with SAP workload. Therefore, it supports the most important Azure resources needed for SAP, as virtual machines, managed disks and Load Balancers. However, you can use RGCOPY also for other workloads.

📝 Note: The list of supported Azure resources is maintained in the RGCOPY documentation: https://github.com/Azure/RGCOPY/blob/main/rgcopy-docu.md#Supported-Azure-Resources

RGCOPY operation modes

RGCOPY has different operation modes. By default, RGCOPY is running in Copy Mode.

  • In Copy Mode, an BICEP or ARM template is exported from the source RG, modified and deployed in the target RG. Disks are copied using snapshots. You can change several resource properties in the target RG:
    • Changing VM size, disk performance tier, disk bursting, disk caching, Write Accelerator, Accelerated Networking
    • Adding, removing, and changing availability configuration: Proximity Placement Groups, Availability Sets, Availability Zones, and VM Scale Sets
    • Converting disk SKUs Premium_LRS, StandardSSD_LRS, Standard_LRS, Premium_ZRS, StandardSSD_ZRS, UltraSSD_LRS and PremiumV2_LRS using (incremental) snapshots and snapshot copy. Changing the logical sector size is not possible.
    • Converting disks to NetApp Volumes and vice versa using file copy
  • In Clone Mode, a VM is cloned within the same resource group. This can be used for adding application servers
  • In Merge Mode, a VM is merged into a different resource group. This can be used for copying a jump box to a different resource group.
  • In Update Mode, you can change resource properties in the source RG, for example VM size, disk performance tier, disk bursting, disk caching, Write Accelerator, Accelerated Networking. For saving costs of unused resource groups, RGCOPY can do the following:
    • Changing disk SKU to 'Standard_LRS' (if the source disk has a logical sector size of 512 byte)
    • Deletion of an Azure Bastion including subnet and IP Address (or creation of a Bastion)
    • Deletion of all snapshots in the source RG
    • Stopping all VMs in the source RG
    • Changing NetApp service level to 'Standard' (or any other service level)

Using RGCOPY for copying SAP systems

I'm frequently asked by SAP customers whether it's a good idea to use RGCOPY for moving their SAP landscape to a different region. The answer is: it depends. Actually, we are using RGCOPY for moving our SAP test landscapes. However, one should consider the following:

  • RGCOPY performs a copy, not a move. Therefore, the SAP license becomes invalid. RGCOPY is not an SAP deployment tool. It just copies Azure resources. It does not change anything inside the VMs like changing the server name at the OS level or applying SAP license keys.
  • RGCOPY copies resources of a single Azure Resource Group. By default, it also copies the virtual network (to a new virtual network). Therefore, you cannot simply copy a landscape that is distributed over different resource groups and networks.
  • The resource types that are supported by RGCOPY is limited. Unsupported resources are not copied.
  • The downtime of a productive system would be quite huge because disk copy to a different region might take a whole day. If you just want to make a copy from production to a test system then downtime is very short: You just need to stop your productive servers for creating the disk snapshots.
  • Since it is a copy you might simply try RGCOPY. First of all, you should start RGCOPY with the parameter simulate. Hereby, you can detect possible issues: RGCOPY checks whether the used VM sizes are available in the target region and zone for your subscription. Furthermore, you can see whether the subscription quota (of VM families, total CPUs and disks) is sufficient.
  • You might use RGCOPY just for copying all disks (in parallel). For this, use the RGCOPY parameter justCopyDisks

📝 Note: Be aware, that RGCOPY has been developed and is maintained by a single person. It is an open source tool, not an official Microsoft product. You can report bugs using GitHub Issues but you will not get help from Microsoft Product Support.

Open Source version of RGCOPY

RGCOPY has been released as Open Source Software (OSS) in

The documentation of the OSS version is available here:

There also exists a Microsoft internal version of RGCOPY with additional features. It is stored in a different repository.

YouTube trainings

You can watch an introduction to RGCOPY on YouTube (22:35):

RGCOPY Update Mode

An overview of RGCOPY Update Mode is also available on YouTube (9:27):

RGCOPY Update Mode

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

rgcopy's People

Contributors

martin-merdes avatar microsoft-github-operations[bot] avatar microsoftopensource avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rgcopy's Issues

Stop copying if ASGs are used in network rules

Hi, Martin!

I have encountered an interesting bug in COPY mode. When running with standard parameters, the following error appears, referring to NSG and ASG (specified as destinations in NSG). This happens at the deployment step, after which the script stops.

In source RG several network rules specify Application security group as Destination.

{"code": "InvalidTemplateDeployment", "message": "The template deployment 'rgcopy.vm_template_rg.TARGET' is not valid according to the validation procedure. The tracking id is ''. See inner errors for details."}

Inner Errors: 
{"code": "SecurityRuleParametersMissing", "target": "/subscriptions//resourceGroups/vm_template_rg/providers/Microsoft.Network/networkSecurityGroups/saturn-nsg", "message": "Required security rule parameters are missing for security rule with Id: /subscriptions//resourceGroups/vm_template_rg/providers/Microsoft.Network/networkSecurityGroups/saturn-nsg/securityRules/SSH. Security rule must specify DestinationAddressPrefixes, DestinationAddressPrefix, or DestinationApplicationSecurityGroups."}

RGCOPY support for storage accounts and images

Hi Martin,

I have a test RG for OpenShift Cluster , and I want to copy it to another RG, but RGCOPY always failed.
I had tried to use RGCOPY to copy a RG with some windows VMs to new RG, and it can successfully copied VNET、NIC、VM、Disk etc, it skipped objects which RGCOPY didn't support.

Does RGCOPY support to copy OpenShift resource? Do I need to edit some value o rgcopy.ps1 first?

RGCOPY showed these error message :

12:07:11 PM - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The resource 'Microsoft.Compute/images/test-lab-rhel' is not defined in the template. Please see https://aka.ms/arm-template for usage details.'.
The deployment validation failed

============================================================
Deployment 'test-lab-rg.2022-06-23__12-06-32' failed
Check the Azure Activity Log in resource group clone-test-lab

RGCOPY TERMINATED: 2022-06-23 12:07:11 UTC+0
CALL STACK: 1
13242 rgcopy.ps1
12438 step-deployment
10072 deploy-templateTarget

ERROR MESSAGE: Deployment 'test-lab-rg.2022-06-23__12-06-32' failed

Copy of Resource Groups with more than 200 resources

Hi Martin,

I am trying to clone a SAP VM but seems there is some limitation on the number of resources in the source RG, getting the below error. Do we need to change something in the script.

Export template is not supported for resource groups that have more than '200' resources.
StatusCode: 409
ReasonPhrase: Conflict
OperationID : 3621d971-5f6d-4f83-8cf6-150bdc3d5f70

============================================================
Could not create JSON template from source RG
Export-AzResourceGroup failed

RGCOPY TERMINATED: 2022-05-26 22:55:45 UTC+5
CALL STACK: 1
13235 rgcopy01.ps1
12218 step-armTemplate
9003 new-templateSource
763 test-azResult

ERROR MESSAGE: Could not create JSON template from source RG

Source VMs stopped Not Stopped when after started by RGCopy

Hi @martin,

The issue is regrading the order of getSourceVMs -> Start source VMs -> Stop source VMs.

image

In above flow, we get source VMs at step getSourceVms,
Step-snapshots, starts the VMs to runs scripts.
Step-cleanup stops the VMs but it uses VM state got at getSourceVMs.

Is VMs were deallocated prior RGCopy, step-cleanup would assume VMs were not stated and won't stop them
with message All VMs are already stopped.

Please let me know if this is expected behaviour.

The Resource 'Microsoft.Network/virtualNetworks/XXXXXXX' under resource group 'XXXXXXXXX' was not found

Hi,

I am using RGCopy to copy resource from one RG to another RG. Can you please help with the below issue?

The deployment 'XXXXXXX.2022-10-26__17-19-45' failed with error(s). Showing 1 out of 1 error(s).
Status Message: The Resource 'Microsoft.Network/virtualNetworks/XXXXXXX' under resource group 'XXXXXXXXX' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix (Code:ResourceNotFound)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.