Skip to content

Commit 174337f

Browse files
committed
Create az functionapp flex-migration commands to migrate CV1 apps to Flex Consumption
1 parent 70b6356 commit 174337f

File tree

5 files changed

+1293
-33
lines changed

5 files changed

+1293
-33
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,33 @@
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 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 migrating 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+
9851012
helps['functionapp plan'] = """
9861013
type: group
9871014
short-summary: Manage App Service Plans for an Azure Function

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

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

241+
with self.argument_context('functionapp flex-migration start') as c:
242+
c.argument('source_resource_group', help='The resource group of the source function app to migrate from.')
243+
c.argument('source_name', help='The name of the source function app to migrate from.')
244+
c.argument('resource_group', help='The resource group of the target function app to migrate to.')
245+
c.argument('name', help='The name of the target function app to migrate to.')
246+
c.argument('storage_account', help='The storage account to use for the target function app. If no storage account is provided, the storage account of the source function app will be used.')
247+
c.argument('maximum_instance_count', type=int, help="The maximum number of instances.")
248+
c.argument('skip_managed_identities', options_list=['--skip-managed-identities', '--smi'], arg_type=get_three_state_flag(return_label=True), help="Skip migrating managed identities.")
249+
c.argument('skip_access_restrictions', options_list=['--skip-access-restrictions', '--sar'], arg_type=get_three_state_flag(return_label=True), help="Skip migrating access restrictions.")
250+
c.argument('skip_storage_mount', options_list=['--skip-storage-mount', '--ssm'], arg_type=get_three_state_flag(return_label=True), help="Skip migrating storage mounts.")
251+
c.argument('skip_hostnames', options_list=['--skip-hostnames', '--sh'], arg_type=get_three_state_flag(return_label=True), help="Skip migrating hostnames.")
252+
c.argument('skip_cors', options_list=['--skip-cors', '--sc'], arg_type=get_three_state_flag(return_label=True), help="Skip migrating CORS settings.")
253+
241254
with self.argument_context('webapp deleted list') as c:
242255
c.argument('name', arg_type=webapp_name_arg_type, id_part=None)
243256
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
@@ -345,6 +345,10 @@ def load_command_table(self, _):
345345
custom_func_name='update_functionapp', getter_type=appservice_custom, setter_type=appservice_custom, command_type=webapp_sdk,
346346
validator=validate_functionapp_on_containerapp_update)
347347

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

0 commit comments

Comments
 (0)