Share via


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 properties file. The different properties are defined as: sourceDbServerResourceId: Source server details. adminCredentials: This parameter lists passwords for admin users for both the source server and the target PostgreSQL flexible server. targetServerUserName: The default value is the admin user created during the creation of the PostgreSQL target flexible server, and the password provided is used for authentication against this user. dbsToMigrate: Specify the list of databases that you want to migrate to Flexible Server. overwriteDBsInTarget: When set to true (default), if the target server happens to have an existing database with the same name as the one you're trying to migrate, the migration service automatically overwrites the database. Sample migrationConfig.json for PostgreSQLSingleServer shown below. { "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" } }

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

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.

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. Use migration-option Validate for validate 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-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

To start a migration for other than PostgreSQLSingleServer, soureType and sslMode must be specified in properties file. These properties are defined as: sourceType: Values can be - OnPremises, AWS_AURORA, AWS_RDS, AzureVM, PostgreSQLSingleServer sslMode: SSL modes for migration. SSL mode for PostgreSQLSingleServer is VerifyFull and Prefer/Require for other source types. Sample migrationConfig.json shown below. { "properties": { "sourceDBServerResourceId": "<<hostname or IP address>>:<<port>>@<<username>>", "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"

Start a private endpoint enabled migration workflow on the target server by specifying migrationRuntimeResourceId in properties file. This property is defined as: migrationRuntimeResourceId: The resource ID of the migration runtime server that is responsible for migrating data between source and target server. Sample migrationConfig.json shown below. { "properties": { "sourceDBServerResourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/test-single-rg/providers/Microsoft.DBforPostgreSQL/servers/pg-single-1", "migrationRuntimeResourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testGroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/testsourcemigration", "secretParameters": { "adminCredentials": { "sourceServerPassword": "password", "targetServerPassword": "password" }, "sourceServerUserName": "testuser@pg-single-1", "targetServerUserName": "fspguser" }, "dBsToMigrate": [ "postgres" ], "overwriteDbsInTarget": "true" } }

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.