Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Migrate from Consumption Plan to App Service Plan (and vice versa) #155

Open
lindydonna opened this issue Jan 19, 2017 · 65 comments
Labels
Milestone

Comments

@lindydonna
Copy link
Contributor

@lindydonna lindydonna commented Jan 19, 2017

From @stephlocke on November 30, 2016 12:4

Is the migration path:

  1. Make sure you have all your keys
  2. Delete existing Function App
  3. Delete Service Plan
  4. Wait for DNS to flush
  5. Create new Function App on Consumption Plan with same name and same storage account
  6. Configure CI, app settings etc

Will this work with all the history so blob's don't get reprocessed etc?

Copied from original issue: Azure/azure-functions-host#1010

@lindydonna

This comment has been minimized.

Copy link
Contributor Author

@lindydonna lindydonna commented Jan 19, 2017

@stephlocke This is better asked on the MSDN forums or StackOverflow (you'll have more folks seeing and answering questions there, as opposed to GitHub isuses).

Are you using blob or queue triggers? Those behave differently in terms of how multiple hosts will process.

@christopheranderson Do you know the answer to this question?

@lindydonna

This comment has been minimized.

Copy link
Contributor Author

@lindydonna lindydonna commented Jan 19, 2017

From @stephlocke on December 2, 2016 20:51

IMO, this should be a docs thing as people will need to do this for maybe
the next year?

@lindydonna

This comment has been minimized.

Copy link
Contributor Author

@lindydonna lindydonna commented Jan 19, 2017

From @stephlocke on December 5, 2016 11:44

I'm using blob triggers, and also eventhub triggers elsewhere that would need migrating also

@lindydonna lindydonna added documentation and removed docs labels Jan 19, 2017
@lindydonna lindydonna changed the title Q: Migration from Service Plans to Consumption Plans How to Migrate from Consumption Plan to App Service Plan (and vice versa) Jan 19, 2017
@lindydonna lindydonna removed the question label Jan 19, 2017
@lindydonna

This comment has been minimized.

Copy link
Contributor Author

@lindydonna lindydonna commented Feb 13, 2017

This will become a real feature soon, so don't need to document.

@lindydonna lindydonna closed this Feb 13, 2017
@jorgechen

This comment has been minimized.

Copy link

@jorgechen jorgechen commented Sep 4, 2017

@lindydonna Any updates on this feature to automatically migrate from Consumption to App Service Plan?

@aherrick

This comment has been minimized.

Copy link

@aherrick aherrick commented Oct 6, 2017

Would also like an update on this! Is there at least a manual process?

@jmarbutt

This comment has been minimized.

Copy link

@jmarbutt jmarbutt commented Oct 25, 2017

I need an update on this also

@JensMadsen

This comment has been minimized.

Copy link

@JensMadsen JensMadsen commented Oct 26, 2017

me too

@leftler

This comment has been minimized.

Copy link

@leftler leftler commented Oct 30, 2017

@lindydonna I would also like a update, it has been several months since we heard anything about this.

@valdisiljuconoks

This comment has been minimized.

Copy link

@valdisiljuconoks valdisiljuconoks commented Oct 30, 2017

she is not working in MS anymore..

@stephlocke

This comment has been minimized.

Copy link

@stephlocke stephlocke commented Oct 30, 2017

@christopheranderson are you able to pick this up? Still a big gaps in the docs / functionality that is still giving people trouble

@lindydonna

This comment has been minimized.

Copy link
Contributor Author

@lindydonna lindydonna commented Oct 30, 2017

@lindydonna lindydonna reopened this Oct 30, 2017
@syedhassaanahmed

This comment has been minimized.

Copy link

@syedhassaanahmed syedhassaanahmed commented Dec 14, 2017

+1

5 similar comments
@neilhosey

This comment has been minimized.

Copy link

@neilhosey neilhosey commented Dec 14, 2017

+1

@mjirhage

This comment has been minimized.

Copy link

@mjirhage mjirhage commented Dec 18, 2017

+1

@mharr

This comment has been minimized.

Copy link

@mharr mharr commented Dec 23, 2017

+1

@talkwaqar

This comment has been minimized.

Copy link

@talkwaqar talkwaqar commented Dec 26, 2017

+1

@patmci

This comment has been minimized.

Copy link

@patmci patmci commented Jan 2, 2018

+1

@leftler

This comment has been minimized.

Copy link

@leftler leftler commented Jan 2, 2018

@jeffhollan can we get any kind of update on this, it has been two months without any kind of word from microsoft about this. Is it at least on the backlog?

@DeV1L

This comment has been minimized.

Copy link

@DeV1L DeV1L commented Mar 15, 2018

@MattFromGer , sorry, commands merged to one line :)
I've fixed it in the comment

@gzepeda

This comment has been minimized.

Copy link

@gzepeda gzepeda commented May 15, 2018

As @DavidJFowler mentions, I need to migrate in order to consume resources on a VPN accessible through a VNET. VNETs are not supported while using Consumption Plans.

@m1nkeh

This comment has been minimized.

Copy link

@m1nkeh m1nkeh commented May 25, 2018

ace, thanks for the PowerShell cmd! 🤓

@Architekt909

This comment has been minimized.

Copy link

@Architekt909 Architekt909 commented Jun 2, 2018

If you're a noob to the azure command line stuff like me and are trying to follow @DeV1L instructions, just click the ">_" icon in your Azure Portal (top right corner, next to the gear/settings icon). Then change the shell from BASH (the default) to "PowerShell Preview" (it's the drop down that appears just above the console that opens up). The instructions worked perfectly, and I just switched from consumption to ASP, allowing me to set "always on" in my serverless functions. Thanks!

@jeffhollan

This comment has been minimized.

Copy link
Member

@jeffhollan jeffhollan commented Jun 13, 2018

And thanks @DeV1L for the script. It should be noted this powershell should work fine when moving from Consumption TO App Service Plan. However when moving from App Service Plan to Consumption there may be an additional challenge in that consumption functions are backed by a storage account, and app service ones do not require one. So an app-service-started function likely doesn't have an associated storage account and could have issues if moving out of an app service plan.

That said the most common migration does seem to be from Consumption into an App Service Plan in which case the PowerShell command (usable in the Azure Cloud Shell) seems like a great fit.

@ggailey777 as FYI as we should create an item to document this in the hosting plans doc for functions

@petrepopescu21

This comment has been minimized.

Copy link

@petrepopescu21 petrepopescu21 commented Aug 2, 2018

@Architekt909 One would argue that running a Function App inside an App Service Plan means it's not serverless anymore.

@ggailey777

This comment has been minimized.

Copy link
Contributor

@ggailey777 ggailey777 commented Aug 2, 2018

@jeffhollan do we have the feature deltas between consumption and App Service plans documented anywhere? Seems like key info when deciding on plans.

@jeffhollan

This comment has been minimized.

Copy link
Member

@jeffhollan jeffhollan commented Aug 2, 2018

Just circling back on this - we have this feature currently planned as a simple operation for the next few months. Plan to make it seamless to move from consumption to app service plan and back again.

@stephlocke

This comment has been minimized.

Copy link

@stephlocke stephlocke commented Aug 3, 2018

I look forward to no longer seeing this in my github notifications! 🤣 Thanks @jeffhollan

@chrisparkeronline

This comment has been minimized.

Copy link

@chrisparkeronline chrisparkeronline commented Aug 20, 2018

I now need this also. I guess a solution would be to remove the function and recreate it. Moving functionality would be much easier.

@Matthewsre

This comment has been minimized.

Copy link

@Matthewsre Matthewsre commented Aug 21, 2018

I am also looking for this feature.

Supporting Hybrid Connections from consumption plans would be ideal for my scenario and I found a feature request to vote on here for those interested:
https://feedback.azure.com/forums/355860-azure-functions/suggestions/33398398-add-support-for-hybrid-connections-to-consumption

@oughton

This comment has been minimized.

Copy link

@oughton oughton commented Aug 21, 2018

Also holding out for this feature instead of manually migrating. Thanks Functions team!

@KirkMunro

This comment has been minimized.

Copy link

@KirkMunro KirkMunro commented Sep 11, 2018

There's also the need to easily switch from one app service plan to another, so that you can measure performance and weigh the pros and cons of a higher cost ASP vs better performance gains that come from it when under load. If this is truly as easy as a PowerShell command, why not just make this available in the Azure UI?

@jeffhollan

This comment has been minimized.

Copy link
Member

@jeffhollan jeffhollan commented Sep 11, 2018

It should be noted there are a few things at play here. There are differences in how Azure Functions on consumption and Azure Functions on app service plan work behind the scenes. Secrets are stored differently, files are stored differently, and scale is handled differently. There is work underway in the next release that will make it possible from an API standpoint to move between consumption and app service plan. There are also changes in defaults so secrets and files should work if an app started as "consumption" and moved to "app service plan." I don't know for sure how many combinations will 'just work', but from my understanding moving from consumption to app service plan should 'just work', and moving from app service plan to consumption will work if it initially started as consumption. There may be some extra steps if the app was 'born' as an app service plan hosted and then is being moved to consumption.

This is an item we want to improve (including portal UX), but has some steps involved and I can't make promises it's all going to work flawlessly even this calendar year. Once I get a feel for what's possible after this next release I can update with more docs and examples, and hopefully we will have some Portal UX by end of the year (on the backlog for sure)

@jorupp

This comment has been minimized.

Copy link

@jorupp jorupp commented Sep 11, 2018

I think we can all understand that sometimes something that looks complex on the surface is a bit harder under the covers :) More blogs on "how this stuff actually works under the covers" is great too :)

What would be helpful to us is just having a clear picture of what we can do now (which may actually be in the docs now - haven't looked at the details recently), what is planned in the near term (w/ rough dates where possible - ie. the visibility we've been getting re: functions v2), and where it's heading long-term (again, rough dates (ie. quarters) are great, but we understand you can't always predict those things).

Sometimes it's hard for us to realize that something doesn't work - there's a lot of documentation out there, and sometimes we think that we must just be missing the thing saying how to do something - calling out the things that don't work (yet) can be just as helpful to guiding us towards the correct decisions for our projects as the docs explaining how to do things.

@KirkMunro

This comment has been minimized.

Copy link

@KirkMunro KirkMunro commented Sep 11, 2018

Also regarding the PowerShell that was shared by @DeV1L earlier (thanks for sharing that), there are a few important details that are worth noting:

  1. When invoking Set-AzureRmWebApp, the -AppServicePlan parameter can only be the app service plan name if everything is in the same region/resource group.
  2. If the app service plan is in a different resource group than the Azure function, you can only switch to it using Set-AzureRmWebApp if you pass in the app service plan id (which can be found by looking up the app service plan with Get-AzureRmAppServicePlan, and then passing in the Id property of the object you get back).
  3. If the app service plan is in a different region than the Azure function, then you cannot switch to it using Set-AzureRmWebApp -- it returns an error indicating "Cannot change the site _________ to the App Service Plan _________ due to hosting constraints."
@BrendanGrant

This comment has been minimized.

Copy link

@BrendanGrant BrendanGrant commented Nov 2, 2018

I can't yet identify the specific case @KirkMunro, however I've encountered a case where a consumption plan function, (now) in the same resource group as the target App Service Plan cannot be moved via Set-AzureRmWebApp... and all are in the same region with the "Cannot change the site _________ to the App Service Plan _________ due to hosting constraints." error.

@ColbyTresness ColbyTresness added this to the Backlog milestone Nov 10, 2018
@myusrn

This comment has been minimized.

Copy link

@myusrn myusrn commented Jan 5, 2019

@jeffhollan where do things stand at this time wrt the function app portal UI support for migrating from consumption app service plan to a pay-as-you-go [payg] app service plan? Likewise wrt any support for ability to go back from payg to consumption app service plan..

In the absence of portal UI support for this it was easy enough to use the powershell Set-AzureRmWebApp cmdlet, that @DeV1L shared earlier, options for going to payg. Would be nice if it was updated to cover going back from payg to consumption plan and perhaps having azure-cli functionapp arguments support for this to cover folks who prefer that cli story.

I have a project where i'm having to do web perf and load test against default of function app, api app nd vm app deployment options and then compare results against incremental scale out of each of those. In function app case this means moving from the consumption plan up to first payg plan that provides scale out instances. I expect i'll have to repeat these comparison tests which is why the ask to be able to go from function app that has been migrated to payg app service plan back to consumption app service plan. I might expect other customers to have non-benchmarking scenarios where they moved from consumption to payg and then realized that didn't make a significant difference, or function app usage model changes, such that going back to consumption makes sense for them.

@nielsbrinch2

This comment has been minimized.

Copy link

@nielsbrinch2 nielsbrinch2 commented Jan 12, 2019

As Azure Functions work differently on Consumption Plan and a an App Service Plan, I don't think investing in a migration makes sense. Some times it doesn't work and then what? Will support have to say that's by design, because they are different. No one will understand that.

As long as they are different, I would fully understand the migration doesn't work and won't get prioritized. Instead these two targeted features would help the migration and they would both work independently:

  1. Transfer application settings from this App Service to that
  2. Swap resource name (domain) between this App Service and that

Unfortunately the latter would depend on a "rename resource" which I do not think is possible. So how would a migration ever work anyway, one way or the other?

But would be a great feature! And it could also be used as a poor mans deployment slots for Functions.

@DavidJFowler

This comment has been minimized.

Copy link

@DavidJFowler DavidJFowler commented Feb 14, 2019

I can't yet identify the specific case @KirkMunro, however I've encountered a case where a consumption plan function, (now) in the same resource group as the target App Service Plan cannot be moved via Set-AzureRmWebApp... and all are in the same region with the "Cannot change the site _________ to the App Service Plan _________ due to hosting constraints." error.

This can occur if the webspaces don't match:

https://social.msdn.microsoft.com/Forums/office/en-US/c498dd15-fb67-4ab3-8e3f-46b9a594dc87/unable-to-transfer-app-services-between-existing-service-plan-same-region-and-same-resource-group?forum=windowsazurewebsitespreview

@jeffhollan

This comment has been minimized.

Copy link
Member

@jeffhollan jeffhollan commented Feb 21, 2019

Ok let me at least give an update as this has gone a little stale and I've learned a lot / we've done some work:

  1. You can change the plan type by modifying the "serverFarmId" property of the Azure Functions Microsoft.Web/sites resource (via something like the az resource CLI command or https://resources.azure.com).
  2. Note that by default apps created in an App Service Plan do not have two important properties: WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE that consumption functions need to scale. These don't hurt to have in an app service plan but you must have them in a consumption plan

So, to move from consumption -> dedicated for now you can use a manual method - but I'd still recommend creating a new app and re-publishing to it. From dedicated -> consumption it may work but make sure you have right app settings first.

We do have some UX and some features coming out in the next month that will allow migration between plan types in the portal

@jeffhollan jeffhollan removed their assignment Feb 27, 2019
@gpazo

This comment has been minimized.

Copy link

@gpazo gpazo commented Mar 18, 2019

@jeffhollan Any updates on adding this to the UI? I tried the commands above by @DeV1L but no luck:

Set-AzureRmWebApp : Operation returned an invalid status code 'NotFound'

I'm attempting to run the commands in the same region migrating from consumption -> dedicated

@adetayorabiu

This comment has been minimized.

Copy link

@adetayorabiu adetayorabiu commented Mar 20, 2019

It can be done easy:

Create new AppService plan
Open CloudShell (PoS)
Run commands
Select-AzureRmSubscription -SubscriptionId "[id]"
Set-AzureRmWebApp -Name "[function name]" -ResourceGroupName "[resource group]" -AppServicePlan "[new app service plan name]"

Hi @DeV1L I get this error when I run this.

Set-AzureRmWebApp : Operation returned an invalid status code 'Conflict'
At line:1 char:1

  • Set-AzureRmWebApp -Name my-fnc-name -ResourceGroupName my-rg-name
    +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : CloseError: (:) [Set-AzWebApp], DefaultErrorResponseException
  • FullyQualifiedErrorId : Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps.SetAzureWebAppCmdlet

@jeffhollan The option to modify serverFarmId via https://resources.azure.com wasn't successful either.

Please help!

@gpazo

This comment has been minimized.

Copy link

@gpazo gpazo commented Mar 20, 2019

@adetayorabiu +1 modifying the serverFarmId using resource explorer caused the page to refresh with the serverFarmId property unchanged

@jeffhollan

This comment has been minimized.

Copy link
Member

@jeffhollan jeffhollan commented Mar 20, 2019

The only officially supported way today to move from consumption to a dedicated app service plan would be to re-deploy. The differences in file and app data storage are technically navigable, but if anyone is stuck I'd recommend redeploying.

Note that there are some limitations if trying to change your app service plan regardless if functions. Things like trying to change the region aren't supported. It's also important to note the note here on webspaces, where even two plans in the same region may not be compatible to move without re-deploy. The way I tested was with two plans in the same resource group so I knew they were in the same webspace.

We are working on easier ways to move from a consumption to more dedicated plan shortly, and do have some UX planned to support that, but it will be limited in scope as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.