Home > Enterprise >  Does the App Service Plans in Azure get moved when i move resources in a Resource Group?
Does the App Service Plans in Azure get moved when i move resources in a Resource Group?

Time:05-19

I am trying to move resources from a resource group in one subscription to another in Azure. Im using Powershell as follows:

Validate

Invoke-AzResourceAction -Action validateMoveResources `
-ResourceId "/subscriptions/{subscription-id}/resourceGroups/{source-rg}" `
-Parameters @{ resources= @("/subscriptions/{subscription-id}/resourceGroups/{source- 
 rg}/providers/{resource-provider}/{resource-type}/{resource-name}", 
 "/subscriptions/{subscription-id}/resourceGroups/{source-rg}/providers/{resource- 
 provider}/{resource-type}/{resource-name}", "/subscriptions/{subscription- 
 id}/resourceGroups/{source-rg}/providers/{resource-provider}/{resource-type}/{resource- 
 name}");targetResourceGroup = '/subscriptions/{subscription- 
 id}/resourceGroups/{destination-rg}' }

Move

$webapp = Get-AzResource -ResourceGroupName OldRG -ResourceName ExampleSite
$plan = Get-AzResource -ResourceGroupName OldRG -ResourceName ExamplePlan
Move-AzResource -DestinationResourceGroupName NewRG -ResourceId $webapp.ResourceId, 
$plan.ResourceId

The App service that I have connects to a database so Im assuming that the database needs to be in that same RG for it to be moved ? Also each resource for example the App Service sits under an App Service Plan, does the App Service Plan get created and moved over into the new Subscripton ? Are database firewall rules moved across as well ?

CodePudding user response:

If you move the resources across the Subscriptions/ Resource group, you have to move the entire resources which you want to move.

If your move requires setting up new dependent resources, you'll experience an interruption in those services until they've been re-configured.

The App service that I have connects to a database so I'm assuming that the database needs to be in that same RG for it to be moved?

Yes, it should be in the same resource group. or you have to re-configure the database connections according to yours.

Also, each resource for example the App Service sits under an App Service Plan, does the App Service Plan get created and moved over into the new Subscription?

Yes, App Service plan can be move to new subscription. But we have some limitations to move App Service from one Resource Group/Subscription to another.

  • Moving a resource to a new resource group or subscription is merely a metadata modification that should have no impact on how the resource works. The inbound IP address for an app service, for example, does not change when the app service is moved.

  • There must be no existing App Service resources in the target resource group. Among the App Service's resources are:

    1. Web Apps
    2. App Service plans Uploaded or imported
    3. TLS/SSL certificates
    4. App Service Environments
  • All App Service resources in the resource group must be moved together.

References

  • Related