Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,5 @@
/src/image-gallery/ @zhoxing-ms

/src/init/ @zhoxing-ms @HuangYT2000

/src/datamigration/ @ashutoshsuman99
8 changes: 8 additions & 0 deletions src/datamigration/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

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

0.1.0
++++++
* Initial release.
139 changes: 139 additions & 0 deletions src/datamigration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Azure CLI datamigration Extension #
This is the extension for datamigration

### How to use ###
Install this extension using the below CLI command
```
az extension add --name datamigration
```

### Included Features ###
#### datamigration to-sql-managed-instance ####
##### Create #####
```
az datamigration to-sql-managed-instance create --managed-instance-name "managedInstance1" \
--source-location "{\\"fileShare\\":{\\"path\\":\\"C:\\\\\\\\aaa\\\\\\\\bbb\\\\\\\\ccc\\",\\"password\\":\\"placeholder\\",\\"username\\":\\"name\\"}}" \
--target-location account-key="abcd" storage-account-resource-id="account.database.windows.net" \
--migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" \
Comment thread
ashutoshsuman99 marked this conversation as resolved.
--offline-configuration last-backup-name="last_backup_file_name" offline=true \
--scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance" \
--source-database-name "aaa" \
--source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" \
--resource-group "testrg" --target-db-name "db1"
```
##### Create #####
```
az datamigration to-sql-managed-instance create --managed-instance-name "managedInstance1" \
--source-location "{\\"fileShare\\":{\\"path\\":\\"C:\\\\\\\\aaa\\\\\\\\bbb\\\\\\\\ccc\\",\\"password\\":\\"placeholder\\",\\"username\\":\\"name\\"}}" \
Comment thread
ashutoshsuman99 marked this conversation as resolved.
Outdated
--target-location account-key="abcd" storage-account-resource-id="account.database.windows.net" \
--migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" \
--offline-configuration last-backup-name="last_backup_file_name" offline=true \
--scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/instance" \
--source-database-name "aaa" \
--source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" \
--resource-group "testrg" --target-db-name "db1"
```
##### Show #####
```
az datamigration to-sql-managed-instance show --managed-instance-name "managedInstance1" --resource-group "testrg" \
--target-db-name "db1"
```
##### Cancel #####
```
az datamigration to-sql-managed-instance cancel --managed-instance-name "managedInstance1" \
--migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" --resource-group "testrg" --target-db-name "db1"
```
##### Cutover #####
```
az datamigration to-sql-managed-instance cutover --managed-instance-name "managedInstance1" \
--migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" --resource-group "testrg" --target-db-name "db1"
```
#### datamigration to-sql-vm ####
##### Create #####
```
az datamigration to-sql-vm create \
--source-location "{\\"fileShare\\":{\\"path\\":\\"C:\\\\\\\\aaa\\\\\\\\bbb\\\\\\\\ccc\\",\\"password\\":\\"placeholder\\",\\"username\\":\\"name\\"}}" \
Comment thread
ashutoshsuman99 marked this conversation as resolved.
Outdated
--target-location account-key="abcd" storage-account-resource-id="account.database.windows.net" \
--migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" \
--offline-configuration last-backup-name="last_backup_file_name" offline=true \
--scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm" \
--source-database-name "aaa" \
--source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" \
--resource-group "testrg" --sql-virtual-machine-name "testvm" --target-db-name "db1"
```
##### Create #####
```
az datamigration to-sql-vm create \
--source-location "{\\"fileShare\\":{\\"path\\":\\"C:\\\\\\\\aaa\\\\\\\\bbb\\\\\\\\ccc\\",\\"password\\":\\"placeholder\\",\\"username\\":\\"name\\"}}" \
Comment thread
ashutoshsuman99 marked this conversation as resolved.
Outdated
--target-location account-key="abcd" storage-account-resource-id="account.database.windows.net" \
--migration-service "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.DataMigration/sqlMigrationServices/testagent" \
--offline-configuration last-backup-name="last_backup_file_name" offline=true \
--scope "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm" \
--source-database-name "aaa" \
--source-sql-connection authentication="WindowsAuthentication" data-source="aaa" encrypt-connection=true password="placeholder" trust-server-certificate=true user-name="bbb" \
--resource-group "testrg" --sql-virtual-machine-name "testvm" --target-db-name "db1"
```
##### Show #####
```
az datamigration to-sql-vm show --resource-group "testrg" --sql-virtual-machine-name "testvm" --target-db-name "db1"
```
##### Cancel #####
```
az datamigration to-sql-vm cancel --migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" \
--resource-group "testrg" --sql-virtual-machine-name "testvm" --target-db-name "db1"
```
##### Cutover #####
```
az datamigration to-sql-vm cutover --migration-operation-id "4124fe90-d1b6-4b50-b4d9-46d02381f59a" \
--resource-group "testrg" --sql-virtual-machine-name "testvm" --target-db-name "db1"
```
#### datamigration sql-service ####
##### Create #####
```
az datamigration sql-service create --location "northeurope" --resource-group "testrg" --name "testagent"

az datamigration sql-service wait --created --resource-group "{rg}" --name "{mySqlMigrationService}"
```
##### Create #####
```
az datamigration sql-service create --location "northeurope" --resource-group "testrg" --name "testagent"

az datamigration sql-service wait --created --resource-group "{rg}" --name "{mySqlMigrationService}"
```
##### List #####
```
az datamigration sql-service list --resource-group "testrg"
```
##### Show #####
```
az datamigration sql-service show --resource-group "testrg" --name "service1"
```
##### Update #####
```
az datamigration sql-service update --tags mytag="myval" --resource-group "testrg" --name "testagent"
```
##### Delete-node #####
```
az datamigration sql-service delete-node --integration-runtime-name "IRName" --node-name "nodeName" \
--resource-group "testrg" --name "service1"
```
##### List-auth-key #####
```
az datamigration sql-service list-auth-key --resource-group "testrg" --name "service1"
```
##### List-integration-runtime-metric #####
```
az datamigration sql-service list-integration-runtime-metric --resource-group "testrg" --name "service1"
```
##### List-migration #####
```
az datamigration sql-service list-migration --resource-group "testrg" --name "service1"
```
##### Regenerate-auth-key #####
```
az datamigration sql-service regenerate-auth-key --key-name "authKey1" --resource-group "testrg" --name "service1"
```
##### Delete #####
```
az datamigration sql-service delete --resource-group "testrg" --name "service1"
```
53 changes: 53 additions & 0 deletions src/datamigration/azext_datamigration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=unused-import

from azure.cli.core import AzCommandsLoader
import azext_datamigration._help


class DataMigrationManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_datamigration.generated._client_factory import cf_datamigration_cl
datamigration_custom = CliCommandType(
operations_tmpl='azext_datamigration.custom#{}',
client_factory=cf_datamigration_cl)
parent = super(DataMigrationManagementClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=datamigration_custom)

def load_command_table(self, args):
from azext_datamigration.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_datamigration.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError as e:
if e.name.endswith('manual.commands'):
pass
else:
raise e
return self.command_table

def load_arguments(self, command):
from azext_datamigration.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_datamigration.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError as e:
if e.name.endswith('manual._params'):
pass
else:
raise e


COMMAND_LOADER_CLS = DataMigrationManagementClientCommandsLoader
20 changes: 20 additions & 0 deletions src/datamigration/azext_datamigration/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import
# pylint: disable=unused-import
from .generated._help import helps # pylint: disable=reimported
try:
from .manual._help import helps # pylint: disable=reimported
except ImportError as e:
if e.name.endswith('manual._help'):
pass
else:
raise e
20 changes: 20 additions & 0 deletions src/datamigration/azext_datamigration/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError as e:
if e.name.endswith('manual.action'):
pass
else:
raise e
4 changes: 4 additions & 0 deletions src/datamigration/azext_datamigration/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.15.0"
}
20 changes: 20 additions & 0 deletions src/datamigration/azext_datamigration/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError as e:
if e.name.endswith('manual.custom'):
pass
else:
raise e
12 changes: 12 additions & 0 deletions src/datamigration/azext_datamigration/generated/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
28 changes: 28 additions & 0 deletions src/datamigration/azext_datamigration/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------


def cf_datamigration_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_datamigration.vendored_sdks.datamigration import DataMigrationManagementClient
return get_mgmt_service_client(cli_ctx,
DataMigrationManagementClient)


def cf_database_migration_sqlmi(cli_ctx, *_):
return cf_datamigration_cl(cli_ctx).database_migrations_sql_mi


def cf_database_migration_sqlvm(cli_ctx, *_):
return cf_datamigration_cl(cli_ctx).database_migrations_sql_vm


def cf_sqlmigration_service(cli_ctx, *_):
return cf_datamigration_cl(cli_ctx).sql_migration_services
Loading