Hi is there a powershell script for moving a web app to an another app service plan who is not in the same resourcegroup. Or can we create a web app where the app service plan is not in the same resource group.
New-AzWebApp -ResourceGroupName $WebAppResourceGroup -Name $testWebAppName -location $location `
-AppServicePlan $appServicePlan01
This script create a new webapp and a new app service plan even there is one exist with the same name. so in case when a want to move the problem resiste the same i cant move it to an existing app service plan.
Set-AzWebApp -Name $WebAppName -ResourceGroupName $WebAppResourceGroup `
-AppServicePlan $appServicePlan02
is there a powershell cmdlet for doing this or do I move the webapp trough the portal.
Thanks
The region in which your app runs is the region of the App Service plan it's in. However, you cannot change an App Service plan's region. If you want to run your app in a different region, one alternative is app cloning. Cloning makes a copy of your app in a new or existing App Service plan in any region.
It can be accomplished by using the Azure Resource Manager version of the PowerShell cmdlet to create a new app with the -SourceWebApp option.
https://learn.microsoft.com/en-us/azure/app-service/app-service-web-app-cloning#cloning-an-existing-app
Related
Is there any Azure CLI command which does the same as this powershell command?
Set-AzWebApp -ResourceGroupName "ResourceName" -Name $webAppName -AppServicePlan $destAppServicePlan
Yes, we do not have the Azure CLI Command to change the App Service Plan for an Azure Web App as having the same functionality with Azure PowerShell commands.
I suggest posting this issue as a feature request in the GitHub-Azure/Azure CLI Repository for getting the better resolution.
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
Say for Suppose i have Logic App 1 ,Logic App 2 ,Logic App 3 etc got created in an Azure Resource Group X. Then Using Azure Powershell Command, I want to get this list of logic apps present under 'X' Azure Resource Group
You should try
Get-AzureRmResource -ResourceType "Microsoft.Logic/workflows" -ResourceGroupName resourcegroupname
It works fine on my side.
This PowerShell Core command should work; replace "myresourcegroup" with the name of the resource group you want to search. In Azure Cloud Shell you can access PowerShell Core by running pwsh.
Find-AzureRmResource -ResourceType "Microsoft.Logic/workflows" -ResourceGroupNameContains "myresourcegroup"
I have been developing deployment scripts to create and automate Azure Web Apps and those are working well.
Today I am trying to move these into an App Service Environment in preparation for production.
I find out that the command used for creating Web Apps doesn't work with an ASE.
New-AzureRmWebApp -ResourceGroupName $ResourceGroupName -Name $SiteName -Location $location -AppServicePlan $AppServicePlan
New-AzureRmWebApp : Server farm with name ASE01 not found.
However when I view in Azure Resource Explorer I can see that the 'Server Farm' is there, along with the normal Web App Service Plans.
Microsoft.Web/serverfarms/ASE01
It's extremely frustrating to spend weeks developing scripts to automate stuff and then find that the App Service Plan simply does not interface with these scripts.
Anyone have any ideas on how I can move forward?
James,
To create WebApps in ASE you need to use the following command
New-AzureRmWebApp -ResourceGroupName WebAppResourceGroup -Name webappname -Location "North Central US" -AppServicePlan WebApp-AppServicePlan -ASEName ASEName -ASEResourceGroupName ASEResourceGroupName
Note that the location parameter is required though not used - just need to be a valid Azure location.
Is it possible to move an Azure Website to a different (or new) App Service Plan?
I have already tried both the old and new portals but cannot find the options for this.
The original accepted answer is more than a year old. In Azure world, that's an eternity. The "Change App Plan" button in the Azure Portal is no longer present it appears (as of 2016-06-17), so I'm throwing in the Powershell command I needed to use in order to move a Webapp to another App Service Plan.
Set-AzureRmWebApp -Name <webapp name> -ResourceGroupName <resource group name> -AppServicePlan <new app service plan>
Set-AzureRmWebAppSlot -Name <webapp name> -Slot <slot name> -ResourceGroupName <resource group name> -AppServicePlan <new app service plan>
The option "Change App Service plan" has been moved to the APP SERVICE PLAN menu.
Yes, you can do this from the Web app blade in the Azure portal. You have to expand the toolbar though to see the option. See below.
I needed to move things between different subscriptions, which is quite possible according to documentation. Much is shamelessly copied from the azure website. This solution is taking advantage of the Azure Powershell 1.0.
First off, if you need to move a Web app and it's connected webfarm there are some limitations:
You can move Azure Web App resources using the ARM Move Resources Api.
Azure Web Apps currently supports the following move scenarios:
Moving the entire contents of a resource group (web apps, app service plans, and certificates) to another resource group.
Note: The destination resource group can not contain any Microsoft.Web resources in this scenario
Moving individual web apps to a different resource group, while still hosting them in their current app service plan (the app service
plan stays in the old resource group)
Basically you need to get the resource id from the resources you want to move and use the Move-AzureRmResource command. You'll naturally need an Azure login which is able to read and write to the subscriptions involved.
$webapp = Get-AzureRmResource -ResourceGroupName OldGroup -ResourceName WebApp -ResourceType Microsoft.Web/sites
$plan = Get-AzureRmResource -ResourceGroupName OldGroup -ResourceName Plan -ResourceType Microsoft.Web/serverFarms
Move-AzureRmResource -DestinationResourceGroupName NewGroup -ResourceId ($webapp.ResourceId, $plan.ResourceId) -DestinationSubscriptionId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
I'd point out that if you're moving the resources to another subscription, there are some caveats. First, that subscription must have rights to provision the website in that region, the API's for that are beyond this scope, but simply creating a website and removing it will give the subscription those rights. In my case i had a second error which is still unresolved, but i suspect that other resources that are connected to the resources being moved are the culprits. Will update with further information if i resolve the issue.
As a final note, there is also the possibility to use the REST API.