az postgres flexible-server migration

Manage migration workflows for PostgreSQL Flexible Servers.

Commands

Name Description Type Status
az postgres flexible-server migration check-name-availability

Checks if the provided migration-name can be used.

Core GA
az postgres flexible-server migration create

Create a new migration workflow for a flexible server.

Core GA
az postgres flexible-server migration list

List the migrations of a flexible server.

Core GA
az postgres flexible-server migration show

Get the details of a specific migration.

Core GA
az postgres flexible-server migration update

Update a specific migration.

Core GA

az postgres flexible-server migration check-name-availability

Checks if the provided migration-name can be used.

az postgres flexible-server migration check-name-availability --migration-name
                                                              [--ids]
                                                              [--name]
                                                              [--resource-group]
                                                              [--subscription]

Examples

Check if the migration-name provided is available for your migration workflow.

az postgres flexible-server migration check-name-availability --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --migration-name xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Required Parameters

--migration-name

Name of the migration.

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Migration target server name.

--resource-group -g

Resource Group Name of the migration target server.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server migration create

Create a new migration workflow for a flexible server.

az postgres flexible-server migration create --name
                                             --properties
                                             --resource-group
                                             [--location]
                                             [--migration-mode {offline, online}]
                                             [--migration-name]
                                             [--migration-option {Migrate, Validate, ValidateAndMigrate}]
                                             [--tags]

Examples

Start a migration workflow on the target server identified by the parameters. The configurations of the migration should be specified in the migrationConfig.json file. Use --migration-mode offline for Offline migration. Sample migrationConfig.json will look like this: { "properties": { "SourceDBServerResourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-single-rg/providers/Microsoft.DBforPostgreSQL/servers/pg-single-1", "SecretParameters": { "AdminCredentials": { "SourceServerPassword": "password", "TargetServerPassword": "password" }, "SourceServerUserName": "testuser@pg-single-1", "TargetServerUserName": "fspguser" }, "dBsToMigrate": [ "postgres" ], "OverwriteDbsInTarget": "true", "SourceType": "PostgreSQLSingleServer", "SslMode": "VerifyFull" } }

az postgres flexible-server migration create --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver         --migration-name testmigration --properties "migrationConfig.json" --migration-mode offline

Start a migration workflow on the target server identified by the parameters. The configurations of the migration should be specified in the migrationConfig.json file. Use --migration-mode online for Online(with CDC) migration, with this sample migrationConfig.json. Use migration-option Validate for validate only request { "properties": { "SourceDBServerResourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-single-rg/providers/Microsoft.DBforPostgreSQL/servers/pg-single-1", "SecretParameters": { "AdminCredentials": { "SourceServerPassword": "password", "TargetServerPassword": "password" }, "SourceServerUserName": "testuser@pg-single-1", "TargetServerUserName": "fspguser" }, "dBsToMigrate": [ "postgres" ], "OverwriteDbsInTarget": "true" } } The sourceType and sslmode parameters are automatically set to 'PostgreSQL Single server' and 'VerifyFull' respectively, if the source resource id follows the /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/{rg-name}/providers/Microsoft.DBforPostgreSQL/servers/{single-server-name} server pattern. Any values passed in the CLI/SDK for these parameters will be ignored.

az postgres flexible-server migration create --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver        --migration-name testmigration --properties "migrationConfig.json" --migration-mode online --migration-option Validate

Start a migration workflow on the target server identified by the parameters. The configurations of the migration should be specified in the migrationConfig.json file. Use --migration-option Migrate for Migrate Only request.

az postgres flexible-server migration create --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver         --migration-name testmigration --properties "migrationConfig.json" --migration-option Migrate

Default migration-option is ValidateAndMigrate. SoureType and SslMode must be passed for migrations other than PostgreSQLSingleServer. Migration parameters in json file should look like below: { "properties": { "SourceDBServerResourceId": "20.66.25.58:5432@postgres", "SecretParameters": { "AdminCredentials": { "SourceServerPassword": "password", "TargetServerPassword": "password" }, "SourceServerUserName": "postgres", "TargetServerUserName": "fspguser" }, "dBsToMigrate": [ "ticketdb","timedb","inventorydb" ], "OverwriteDbsInTarget": "true", "SourceType": "OnPremises", "SslMode": "Prefer" } }

az postgres flexible-server migration create --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver         --migration-name testmigration --properties "migrationConfig.json"

Required Parameters

--name -n

Migration target server name.

--properties -b

Request properties. Use double or no quotes to pass in json filepath as argument.

--resource-group -g

Resource Group Name of the migration target server.

Optional Parameters

--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--migration-mode

Either offline or online(with CDC) migration.

accepted values: offline, online
default value: offline
--migration-name

Name of the migration.

--migration-option

Supported Migration Option. Default is ValidateAndMigrate.

accepted values: Migrate, Validate, ValidateAndMigrate
default value: ValidateAndMigrate
--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server migration list

List the migrations of a flexible server.

az postgres flexible-server migration list --name
                                           --resource-group
                                           [--filter {Active, All}]

Examples

List the currently active migrations of a target flexible server.

az postgres flexible-server migration list --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --filter Active

List all (Active/Completed) migrations of a target flexible server.

az postgres flexible-server migration list --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --filter All

Required Parameters

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

Resource Group Name of the migration target server.

Optional Parameters

--filter

Indicate whether all the migrations or just the Active migrations are returned. Valid values are: Active and All.

accepted values: Active, All
default value: Active
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server migration show

Get the details of a specific migration.

az postgres flexible-server migration show --migration-name
                                           [--ids]
                                           [--name]
                                           [--resource-group]
                                           [--subscription]

Examples

Get the details of a specific migration of a target flexible server.

az postgres flexible-server migration show --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --migration-name testmigration

Required Parameters

--migration-name

Name of the migration.

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Migration target server name.

--resource-group -g

Resource Group Name of the migration target server.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server migration update

Update a specific migration.

az postgres flexible-server migration update --migration-name
                                             [--cancel]
                                             [--cutover]
                                             [--ids]
                                             [--name]
                                             [--resource-group]
                                             [--setup-replication]
                                             [--subscription]

Examples

Allow the migration workflow to setup logical replication on the source. Note that this command will restart the source server.

az postgres flexible-server migration update --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --migration-name testmigration --setup-replication

Cut-over the data migration for all the databases involved in the migration. After this is complete, subsequent updates to all databases in the migration will not be migrated to the target. Cutover migration can only be triggered for migration_mode=Online.

az postgres flexible-server migration update --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --migration-name testmigration --cutover

Cancels the data migration for all the databases involved in the migration. Only 'InProgress' migration can be cancelled

az postgres flexible-server migration update --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --resource-group testGroup --name testserver --migration-name testmigration --cancel

Required Parameters

--migration-name

Name of the migration.

Optional Parameters

--cancel

Cancel the data migration for all the databases.

--cutover

Cut-over the data migration for all the databases in the migration. After this is complete, subsequent updates to all databases will not be migrated to the target.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Migration target server name.

--resource-group -g

Resource Group Name of the migration target server.

--setup-replication

Allow the migration workflow to setup logical replication on the source. Note that this command will restart the source server.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.