Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/migrate/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

Release History
===============

0.1.0
++++++
* Initial release.
5 changes: 5 additions & 0 deletions src/migrate/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Microsoft Azure CLI 'migrate' Extension
==========================================

This package is for the 'migrate' extension.
i.e. 'az migrate'
32 changes: 32 additions & 0 deletions src/migrate/azext_migrate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader

from .generated._help import helps # pylint: disable=unused-import


class AzureMigrateCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from .generated._client_factory import cf_migrate
migrate_custom = CliCommandType(
operations_tmpl='azext_migrate.custom#{}',
client_factory=cf_migrate)
super(AzureMigrateCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=migrate_custom)

def load_command_table(self, args):
from .generated.commands import load_command_table
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from .generated._params import load_arguments
load_arguments(self, command)


COMMAND_LOADER_CLS = AzureMigrateCommandsLoader
13 changes: 13 additions & 0 deletions src/migrate/azext_migrate/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError:
pass
4 changes: 4 additions & 0 deletions src/migrate/azext_migrate/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.0.67"
}
13 changes: 13 additions & 0 deletions src/migrate/azext_migrate/commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.commands import * # noqa: F403
try:
from .manual.commands import * # noqa: F403
except ImportError:
pass
13 changes: 13 additions & 0 deletions src/migrate/azext_migrate/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError:
pass
34 changes: 34 additions & 0 deletions src/migrate/azext_migrate/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------


def cf_migrate(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.migrate import AzureMigrate
return get_mgmt_service_client(cli_ctx, AzureMigrate)


def cf_assessment_option(cli_ctx, *_):
return cf_migrate(cli_ctx).assessment_option


def cf_project(cli_ctx, *_):
return cf_migrate(cli_ctx).project


def cf_machine(cli_ctx, *_):
return cf_migrate(cli_ctx).machine


def cf_group(cli_ctx, *_):
return cf_migrate(cli_ctx).group


def cf_assessment(cli_ctx, *_):
return cf_migrate(cli_ctx).assessment


def cf_assessed_machine(cli_ctx, *_):
return cf_migrate(cli_ctx).assessed_machine
242 changes: 242 additions & 0 deletions src/migrate/azext_migrate/generated/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=too-many-lines
# pylint: disable=line-too-long
from knack.help_files import helps # pylint: disable=unused-import


helps['migrate assessment-option'] = """
type: group
short-summary: migrate assessment-option
"""

helps['migrate assessment-option show'] = """
type: command
short-summary: Get the available options for the properties of an assessment.
examples:
- name: AssessmentOptions_Get
text: |-
az migrate assessment-option show --location-name "SoutheastAsia"
"""

helps['migrate project'] = """
type: group
short-summary: migrate project
"""

helps['migrate project list'] = """
type: command
short-summary: Get all the projects in the subscription.
examples:
- name: Projects_List
text: |-
az migrate project list --resource-group "myResourceGroup"
"""

helps['migrate project show'] = """
type: command
short-summary: Get the project with the specified name.
examples:
- name: Projects_Get
text: |-
az migrate project show --project-name "project01" --resource-group "myResourceGroup"
"""

helps['migrate project create'] = """
type: command
short-summary: Create a project with specified name. If a project already exists, update it.
examples:
- name: Projects_Create
text: |-
az migrate project create --e-tag "\\"b701c73a-0000-0000-0000-59c12ff00000\\"" --location \\
"West Us" --customer-workspace-id "url-to-customers-service-map" \\
--customer-workspace-location "West Us" --project-name "project01" --resource-group \\
"myResourceGroup"
"""

helps['migrate project update'] = """
type: command
short-summary: Update a project with specified name. Supports partial updates, for example only tags can be provided.
examples:
- name: Projects_Update
text: |-
az migrate project update --e-tag "" --location "West Us" --customer-workspace-id \\
"url-to-customers-service-map" --customer-workspace-location "West Us" --project-name \\
"project01" --resource-group "myResourceGroup"
"""

helps['migrate project delete'] = """
type: command
short-summary: Delete the project. Deleting non-existent project is a no-operation.
examples:
- name: Projects_Delete
text: |-
az migrate project delete --project-name "project01" --resource-group "myResourceGroup"
"""

helps['migrate project get-key'] = """
type: command
short-summary: Gets the Log Analytics Workspace ID and Primary Key for the specified project.
examples:
- name: Projects_GetKeys
text: |-
az migrate project get-key --project-name "project01" --resource-group "myResourceGroup"
"""

helps['migrate machine'] = """
type: group
short-summary: migrate machine
"""

helps['migrate machine list'] = """
type: command
short-summary: Get data of all the machines available in the project. Returns a json array of objects of type 'machine' defined in Models section.
examples:
- name: Machines_ListByProject
text: |-
az migrate machine list --project-name "project01" --resource-group "myResourceGroup"
"""

helps['migrate machine show'] = """
type: command
short-summary: Get the machine with the specified name. Returns a json object of type 'machine' defined in Models section.
examples:
- name: Machines_Get
text: |-
az migrate machine show --machine-name "amansing_vm1" --project-name "project01" \\
--resource-group "myResourceGroup"
"""

helps['migrate group'] = """
type: group
short-summary: migrate group
"""

helps['migrate group list'] = """
type: command
short-summary: Get all groups created in the project. Returns a json array of objects of type 'group' as specified in the Models section.
examples:
- name: Groups_ListByProject
text: |-
az migrate group list --project-name "project01" --resource-group "myResourceGroup"
"""

helps['migrate group show'] = """
type: command
short-summary: Get information related to a specific group in the project. Returns a json object of type 'group' as specified in the models section.
examples:
- name: Groups_Get
text: |-
az migrate group show --group-name "group01" --project-name "project01" --resource-group \\
"myResourceGroup"
"""

helps['migrate group create'] = """
type: command
short-summary: Create a new group by sending a json object of type 'group' as given in Models section as part of the Request Body. The group name in a project is unique. Labels can be applied on a group as part of creation. If a group with the groupName specified in the URL already exists, then this call acts as an update. This operation is Idempotent.
examples:
- name: Groups_Create
text: |-
az migrate group create --e-tag "\\"1100637e-0000-0000-0000-59f6ed1f0000\\"" --group-name \\
"group01" --project-name "project01" --resource-group "myResourceGroup"
"""

helps['migrate group delete'] = """
type: command
short-summary: Delete the group from the project. The machines remain in the project. Deleting a non-existent group results in a no-operation. A group is an aggregation mechanism for machines in a project. Therefore, deleting group does not delete machines in it.
examples:
- name: Groups_Delete
text: |-
az migrate group delete --group-name "group01" --project-name "project01" \\
--resource-group "myResourceGroup"
"""

helps['migrate assessment'] = """
type: group
short-summary: migrate assessment
"""

helps['migrate assessment list'] = """
type: command
short-summary: Get all assessments created in the project. Returns a json array of objects of type 'assessment' as specified in Models section.
examples:
- name: Assessments_ListByGroup
text: |-
az migrate assessment list --group-name "group01" --project-name "project01" \\
--resource-group "myResourceGroup"
"""

helps['migrate assessment show'] = """
type: command
short-summary: Get an existing assessment with the specified name. Returns a json object of type 'assessment' as specified in Models section.
examples:
- name: Assessments_Get
text: |-
az migrate assessment show --assessment-name "assessment01" --group-name "group01" \\
--project-name "project01" --resource-group "myResourceGroup"
"""

helps['migrate assessment create'] = """
type: command
short-summary: Create a new assessment with the given name and the specified settings. Since name of an assessment in a project is a unique identifier, if an assessment with the name provided already exists, then the existing assessment is updated. Any PUT operation, resulting in either create or update on an assessment, will cause the assessment to go in a "InProgress" state. This will be indicated by the field 'computationState' on the Assessment object. During this time no other PUT operation will be allowed on that assessment object, nor will a Delete operation. Once the computation for the assessment is complete, the field 'computationState' will be updated to 'Ready', and then other PUT or DELETE operations can happen on the assessment. When assessment is under computation, any PUT will lead to a 400 - Bad Request error.
examples:
- name: Assessments_Create
text: |-
az migrate assessment create --e-tag "\\"1100637e-0000-0000-0000-59f6ed1f0000\\"" \\
--azure-hybrid-use-benefit "Yes" --azure-location "WestUs" --azure-offer-code \\
"MSAZR0003P" --azure-pricing-tier "Standard" --azure-storage-redundancy \\
"LocallyRedundant" --currency "USD" --discount-percentage 100 --percentile "Percentile50" \\
--scaling-factor 1.2 --sizing-criterion "PerformanceBased" --stage "InProgress" \\
--time-range "Day" --assessment-name "assessment01" --group-name "group01" --project-name \\
"project01" --resource-group "myResourceGroup"
"""

helps['migrate assessment delete'] = """
type: command
short-summary: Delete an assessment from the project. The machines remain in the assessment. Deleting a non-existent assessment results in a no-operation. When an assessment is under computation, as indicated by the 'computationState' field, it cannot be deleted. Any such attempt will return a 400 - Bad Request.
examples:
- name: Assessments_Delete
text: |-
az migrate assessment delete --assessment-name "assessment01" --group-name "group01" \\
--project-name "project01" --resource-group "myResourceGroup"
"""

helps['migrate assessment get-report-download-url'] = """
type: command
short-summary: Get the URL for downloading the assessment in a report format.
examples:
- name: Assessments_GetReportDownloadUrl
text: |-
az migrate assessment get-report-download-url --assessment-name "assessment01" \\
--group-name "group01" --project-name "project01" --resource-group "myResourceGroup"
"""

helps['migrate assessed-machine'] = """
type: group
short-summary: migrate assessed-machine
"""

helps['migrate assessed-machine list'] = """
type: command
short-summary: Get list of machines that assessed as part of the specified assessment. Returns a json array of objects of type 'assessedMachine' as specified in the Models section. Whenever an assessment is created or updated, it goes under computation. During this phase, the 'status' field of Assessment object reports 'Computing'. During the period when the assessment is under computation, the list of assessed machines is empty and no assessed machines are returned by this call.
examples:
- name: AssessedMachines_ListByAssessment
text: |-
az migrate assessed-machine list --assessment-name "assessment01" --group-name "group01" \\
--project-name "project01" --resource-group "myResourceGroup"
"""

helps['migrate assessed-machine show'] = """
type: command
short-summary: Get an assessed machine with its size & cost estimate that was evaluated in the specified assessment.
examples:
- name: AssessedMachines_Get
text: |-
az migrate assessed-machine show --assessed-machine-name "amansing_vm1" --assessment-name \\
"assessment01" --group-name "group01" --project-name "project01" --resource-group \\
"myResourceGroup"
"""
Loading