Skip to content

Commit c3df1ba

Browse files
committed
Create az functionapp flex-migration commands to migrate CV1 apps to Flex Consumption
1 parent f691bc7 commit c3df1ba

File tree

5 files changed

+722
-25
lines changed

5 files changed

+722
-25
lines changed

src/azure-cli/azure/cli/command_modules/appservice/_help.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,37 @@
982982
short-summary: List available built-in stacks which can be used for function apps on the Flex Consumption plan.
983983
"""
984984

985+
helps['functionapp flex-migration'] = """
986+
type: group
987+
short-summary: Manage migration of Linux Consumption function apps to the Flex Consumption plan.
988+
"""
989+
990+
helps['functionapp flex-migration start'] = """
991+
type: command
992+
short-summary: Create a new Flex Consumption app with the same settings as the provided Linux Consumption function app.
993+
examples:
994+
- name: Migrate a Linux Consumption function app to the Flex Consumption plan.
995+
text: >
996+
az functionapp flex-migration start --source-name MyLinuxConsumptionApp --source-resource-group MyLinuxConsumptionResourceGroup --name MyFunctionApp --resource-group MyResourceGroup --storage-account MyStorageAccount
997+
998+
- name: Migrate a Linux Consumption function app to the Flex Consumption plan without configuring managed identity configurations.
999+
text: >
1000+
az functionapp flex-migration start --source-name MyLinuxConsumptionApp --source-resource-group MyLinuxConsumptionResourceGroup --name MyFunctionApp --resource-group MyResourceGroup --storage-account MyStorageAccount --skip-managed-identities
1001+
"""
1002+
1003+
helps['functionapp flex-migration list'] = """
1004+
type: command
1005+
short-summary: List all Linux Consumption function apps that are eligible for migration to the Flex Consumption plan.
1006+
examples:
1007+
- name: List all Linux Consumption function apps that are eligible for migration to the Flex Consumption plan.
1008+
text: >
1009+
az functionapp flex-migration list
1010+
1011+
- name: List all Linux Consumption function apps that are eligible for migration to the Flex Consumption plan, ignoring if they have slots configured. Please note that slots are not supported in the Flex Consumption plan.
1012+
text: >
1013+
az functionapp flex-migration list --ignore-slots
1014+
"""
1015+
9851016
helps['functionapp plan'] = """
9861017
type: group
9871018
short-summary: Manage App Service Plans for an Azure Function

src/azure-cli/azure/cli/command_modules/appservice/_params.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,25 @@ def load_arguments(self, _):
232232
help='Include the runtime details of the regions.', is_preview=True)
233233
c.argument('runtime', help="limit the output to just the specified runtime", is_preview=True)
234234

235+
with self.argument_context('functionapp flex-migration list') as c:
236+
c.argument('ignore_slots', arg_type=get_three_state_flag(return_label=True),
237+
help="Skip the check for slots for the existing function app. Please note that Flex Consumption does not support slots, so this should only be used if you do not intend to use slots.")
238+
239+
with self.argument_context('functionapp flex-migration start') as c:
240+
c.argument('source_resource_group', help='The resource group of the source function app to migrate from.')
241+
c.argument('source_name', help='The name of the source function app to migrate from.')
242+
c.argument('resource_group', help='The resource group of the target function app to migrate to.')
243+
c.argument('name', help='The name of the target function app to migrate to.')
244+
c.argument('storage_account', help='The storage account to use for the target function app.')
245+
c.argument('maximum_instance_count', type=int, help="The maximum number of instances.")
246+
c.argument('skip_managed_identities', options_list=['--skip-managed-identities', '--smi'], arg_type=get_three_state_flag(return_label=True), help="Skip managed identities migration.")
247+
c.argument('skip_access_restrictions', options_list=['--skip-access-restrictions', '--sar'], arg_type=get_three_state_flag(return_label=True), help="Skip access restrictions migration.")
248+
c.argument('skip_storage_mount', options_list=['--skip-storage-mount', '--ssm'], arg_type=get_three_state_flag(return_label=True), help="Skip storage mount migration.")
249+
c.argument('skip_hostnames', options_list=['--skip-hostnames', '--sh'], arg_type=get_three_state_flag(return_label=True), help="Skip hostnames migration.")
250+
c.argument('skip_cors', options_list=['--skip-cors', '--sc'], arg_type=get_three_state_flag(return_label=True), help="Skip CORS migration.")
251+
c.argument('ignore_slots', arg_type=get_three_state_flag(return_label=True),
252+
help="Skip the check for slots for the existing function app. Please note that Flex Consumption does not support slots, so this should only be used if you do not intend to use slots.")
253+
235254
with self.argument_context('webapp deleted list') as c:
236255
c.argument('name', arg_type=webapp_name_arg_type, id_part=None)
237256
c.argument('slot', options_list=['--slot', '-s'], help='Name of the deleted web app slot.')

src/azure-cli/azure/cli/command_modules/appservice/commands.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ def load_command_table(self, _):
344344
custom_func_name='update_functionapp', getter_type=appservice_custom, setter_type=appservice_custom, command_type=webapp_sdk,
345345
validator=validate_functionapp_on_containerapp_update)
346346

347+
with self.command_group('functionapp flex-migration') as g:
348+
g.custom_command('start', 'migrate_consumption_to_flex', exception_handler=ex_handler_factory())
349+
g.custom_command('list', 'list_flex_migration_candidates', exception_handler=ex_handler_factory())
350+
347351
with self.command_group('functionapp deployment config') as g:
348352
g.custom_command('set', 'update_deployment_configs', exception_handler=ex_handler_factory(), validator=validate_is_flex_functionapp)
349353
g.custom_show_command('show', 'get_deployment_configs', exception_handler=ex_handler_factory(), validator=validate_is_flex_functionapp)

0 commit comments

Comments
 (0)