Share via

Use bicep to move sql server

Hao Hu 20 Reputation points Microsoft External Staff
2024-01-11T15:42:22.1633333+00:00

Can we use bicep to move sql server from one resource group to another resource group? I have a sql server in resource group A, and I want to move this sql server to resource group B, both resource group are under same subscription.

Azure SQL Database

2 answers

Sort by: Most helpful
  1. Azar 31,720 Reputation points MVP Volunteer Moderator
    2024-01-11T16:03:01.4566667+00:00

    Hi Hao Hu, I think bicep/ does not move resources between resource groups. The movement of resources between resource groups can be done by using Azure Resource Manager (ARM) templates or through the Azure portal.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. Pinaki Ghatak 5,695 Reputation points Microsoft Employee
    2024-01-11T16:54:14.04+00:00

    Hello Hao Hu Moving an Azure SQL Server from one resource group to another involves several steps:

    1. Checklist before moving resources: Verify the source and destination subscriptions are active and exist within the same Microsoft Entra tenant<sup>1</sup>. You can check this using Azure PowerShell or Azure CLI.
    2. Move the resources: You can use the Azure portal, Azure PowerShell, Azure CLI, or the REST API to move resources. During the move operation, both the source group and the target group are locked. This means you can’t add, update, or delete resources in the resource groups during the move. However, the resources are not frozen. For example, if you move an Azure SQL logical server, its databases and other dependent resources to a new resource group or subscription, applications that use the databases experience no downtime. They can still read and write to the databases<sup>1</sup>.
    3. Changed resource ID: When you move a resource, you change its resource ID. If you use the resource ID anywhere, you’ll need to update that value.

    Please note that moving a resource only moves it to a new resource group or subscription. It doesn’t change the location of the resource. For Azure CLI, you can use the az resource move command. In the --ids parameter, provide a space-separated list of the resource IDs to move. Remember, it’s important to verify these conditions to avoid errors during the move. If your move requires setting up new dependent resources, you’ll experience an interruption in those services until they’ve been reconfigured. I hope this solves your question. If so, please tag this as answered.

    Was this answer helpful?

    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.