Can I move app service and dependencies between subscriptions? - azure

I am using the Azure Resource Mover under preview.azure.portal to move an app service and its dependencies between subscriptions but keep encountering the following error:
{"code":"ResourceMoveProviderValidationFailed","target":"Microsoft.Web/sites","message":"{"Code":"BadRequest","Message":"Please select all the Microsoft.Web resources from 'SourceTestRG
resource group for cross-subscription migration.
Also, please ensure destination resource group 'DestTestRG'
doesn't have any Microsoft.Web resources before move operation.
Here is the list of resources you have to move together: AzureTestAppTest (Microsoft.Web/sites).
This resource is located in resource group 'SourceTestRG',
but hosted in the resource group 'AppsRG'. This may be a result of prior move operations.
The destination RG 'DestTestRG' does not have any resources.
Any ideas on what may be the issue ?
UPDATE:
So basically the process is as follows ?
Create an App service plan lets say MainAppServicePlan in a ResourceGroup lets say ASPRG1 under subscription MainSub1
You can create resources in different resource groups for example:
App Service: AppService1 in ResourceGroup RGApp1
App Service: AppService2 in ResourceGroup RGApp2
App Service: AppService3 in ResourceGroup RGApp3
But thay all are under the App Service Plan ASPRG1.
That means if i try to move from AppService1 from MainSub1 to MainSub2 it will give an error
because i am required to move AppService2 and AppService3, is that correct ?
If that is the case , wouldn't it be feasible to create a brand new App Service Plan and move AppService1 to that new
AppService Plan and then since no other resource resides in that App Servie Plan then the cross subscription migration should be ok ?
Can the app service plan be changed once it is already set on an app service ?

App Service resources and Resource Groups are tied together internally, and it's not always transparent. See the Move guidance for all considerations.
Specifically:
All App Service resources in the resource group must be moved together.
App Service resources can only be moved from the resource group in which they were originally created. If an App Service resource is no
longer in its original resource group, move it back to its original
resource group. Then, move the resource across subscriptions.

Related

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

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 ?
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:
Web Apps
App Service plans Uploaded or imported
TLS/SSL certificates
App Service Environments
All App Service resources in the resource group must be moved together.
References
Move resources to a new resource group / subscription
App Service Limitations

If a blank Azure Subscription is provided, how do you deploy a new Resource Group, and is it free?

If a blank Azure Subscription is provided, how do you deploy a new Resource Group, and is it free?
And following deployment of a new Resource Group, are there any steps that need to be undertaken before deploying resources to the newly created resource group?
how do you deploy a new Resource Group, and is it free?
There are various API's (REST API, Powershell, Azure CLI) to do this. The easiest is doing it interactively from the Azure portal. A resource group is free
And following deployment of a new Resource Group, are there any steps that need to be undertaken before deploying resources to the newly created resource group?
Generally No. Unless it is locked (by default it isn't) or has specific security stopping you (which won't be an isse if you are the same user)

Moving azure resources from one resource group to another

I have two resource groups in our azure account, one(A) is having all the database(SQL) resources and other one(B) having other resources like app service, key vault, service bus etc.
Now we have decided to make a single resource group and we are trying to move SQL resources from resource group A resource group B. but it gives duplicate resources error as saying the resources we are trying to move is already there. But I have checked properly and those resources are not in resource group B.I have checked hidden types as well.
(A)
(B)

Move app service from one app service plan to another (same resource group and region)

I have two app service plans running in the same region, same resource group and in the same subscription. I have a web app in app service plan a, that I want to move to app service plan b. When clicking Change App Service Plan, the Portal tells me that "No App Service Plans Found".
App service plan a is running on Standard: 1 Small. App service plan b is running on Standard: 2 Large. Changing app service plan a to Standard: 1 Large, doesn't make app service plan b show up when trying to move the app service.
What could be the problem here?
I'm pretty sure I found out why I cannot move my app service between plans. Besides resource groups, subscriptions and regions, there is a concept called Webspaces. As I understand it, a webspace is a number of physical servers within the same rack or something similar. In order to move app services between plans, the app services needs to be within the same webspace too.
You have to check the webspace between the 2 App Service Plans. Are there identical?
You might move (multiple times) your App Service Plan to different Ressource Group but the webspace is based on your original Resource Group (when you created this App Service Plan the first time)
You might have also deleted your original Resource Group, so you might have to recreate it? (I have never tried this case, but it should create in the same webspace then)
To check I use PowerShell command:
Login-AzureRMAccount
Get-AzureRmSubscription
Select-AzureRmSubscription -SubscriptionId <Your Subscription Guid>
Get-AzureRmResource -ResourceId "/subscriptions/<SUB-ID>/resourceGroups/<RG-NAME>/resources" | Select Name, ResourceName, #{Name='webSpace'; Expression={$_.Properties.webSpace}} | Format-List
For the name space, you will get something like:
Name : Consoto_AppServicePlan
ResourceName : Consoto_ResourceGroup
webSpace : Consoto-SouthCentralUSwebspace
(Supposed that the location is South Central US)
So if you want to move your App Service to another App Service Plan name, you will have to create a new App Service Plan in the Resource Group named "Consoto" (refer to my example above) in the Location South Central US in the same subscription of course.
Then you will be able to use the Change App Service Plan functionality in the Azure Portal

Is it possible to rename an Azure App Service plan using the Azure Portal?

Is it possible to rename an App Service Plan?
I have already tried in both the old and new portals and can't find any rename options.
No, you can't.
However, if you create a new App Service Plan in the same region and resource group then you can move all your sites to the new App Service Plan and delete the old one.
No but you can change it like this (if it is in the same region and resource group as mentioned by Zain Rizvi):
Create a new App Service Plan and bind it to the correct Subscription and Resource Group. Example:
Then go to your App Service and choose "Change App Service plan"

Resources