Share via


Migrations - Update

Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions.

PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations/{migrationName}?api-version=2024-08-01

URI Parameters

Name In Required Type Description
migrationName
path True

string

pattern: ^[a-z][a-z0-9]*$

Name of migration.

resourceGroupName
path True

string

pattern: ^[-a-z0-9A-Z._()]+[^.]$

Name of resource group of target database server.

subscriptionId
path True

string

pattern: ([a-z0-9]){8,8}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){12,12}

Identifier of subscription of target database server.

targetDbServerName
path True

string

pattern: ([-a-z0-9]){3,63}

Name of target database server.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Type Description
properties.cancel

CancelEnum

Indicates if cancel must be triggered for the entire migration.

properties.dbsToCancelMigrationOn

string[]

When you want to trigger cancel for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array.

properties.dbsToMigrate

string[]

Names of databases to migrate.

properties.dbsToTriggerCutoverOn

string[]

When you want to trigger cutover for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array.

properties.migrateRoles

MigrateRolesEnum

Indicates if roles and permissions must be migrated.

properties.migrationMode

MigrationMode

Mode used to perform the migration: Online or Offline.

properties.migrationWindowStartTimeInUtc

string (date-time)

Start time (UTC) for migration window.

properties.overwriteDbsInTarget

OverwriteDbsInTargetEnum

Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation.

properties.secretParameters

MigrationSecretParameters

Migration secret parameters.

properties.setupLogicalReplicationOnSourceDbIfNeeded

LogicalReplicationOnSourceDbEnum

Indicates whether to setup LogicalReplicationOnSourceDb, if needed.

properties.sourceDbServerFullyQualifiedDomainName

string

Fully qualified domain name (FQDN) or IP address of the source server. This property is optional. When provided, the migration service will always use it to connect to the source server.

properties.sourceDbServerResourceId

string

Identifier of the source database server resource, when 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to ipaddress:port@username or hostname:port@username.

properties.startDataMigration

StartDataMigrationEnum

Indicates if data migration must start right away.

properties.targetDbServerFullyQualifiedDomainName

string

Fully qualified domain name (FQDN) or IP address of the target server. This property is optional. When provided, the migration service will always use it to connect to the target server.

properties.triggerCutover

TriggerCutoverEnum

Indicates if cutover must be triggered for the entire migration.

tags

object

Application-specific metadata in the form of key-value pairs.

Responses

Name Type Description
200 OK

MigrationResource

OK

Other Status Codes

ErrorResponse

Error response describing why the operation failed.

Security

azure_auth

Microsoft Entra OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Cancel an existing migration.
Update an existing migration.

Cancel an existing migration.

Sample request

PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampletarget/migrations/examplemigration?api-version=2024-08-01

{
  "properties": {
    "cancel": "True"
  }
}

Sample response

{
  "properties": {
    "migrationId": "d3ceacbb-a5fd-43dc-a9db-6022b5154856",
    "currentStatus": {
      "state": "Canceled",
      "currentSubStateDetails": {
        "currentSubState": "Completed"
      }
    },
    "migrationMode": "Online",
    "migrationWindowEndTimeInUtc": "2024-08-01T20:30:22.123456Z",
    "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource",
    "targetDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/flexibleServers/exampletarget",
    "dbsToMigrate": [
      "postgres"
    ],
    "setupLogicalReplicationOnSourceDbIfNeeded": "True",
    "overwriteDbsInTarget": "True",
    "migrationWindowStartTimeInUtc": "2024-08-01T18:30:22.123456Z",
    "migrateRoles": "False",
    "sourceDbServerMetadata": {
      "location": "westus",
      "sku": {
        "name": "B_Gen5_2",
        "tier": "Basic"
      }
    },
    "targetDbServerMetadata": {
      "location": "westus",
      "sku": {
        "name": "Standard_D2ds_v4",
        "tier": "GeneralPurpose"
      }
    }
  },
  "location": "westus",
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/flexibleServers/exampletarget/migrations/examplemigration",
  "name": "examplemigration",
  "type": "Microsoft.DBForPostgreSql/flexibleServers/migrations"
}

Update an existing migration.

Sample request

PATCH https://management.azure.com/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampletarget/migrations/examplemigration?api-version=2024-08-01

{
  "properties": {
    "setupLogicalReplicationOnSourceDbIfNeeded": "True"
  }
}

Sample response

{
  "properties": {
    "migrationId": "d3ceacbb-a5fd-43dc-a9db-6022b5154856",
    "currentStatus": {
      "state": "InProgress",
      "error": "",
      "currentSubStateDetails": {
        "currentSubState": "PerformingPreRequisiteSteps"
      }
    },
    "sourceDbServerMetadata": {
      "location": "westus",
      "version": "10",
      "storageMb": 1024,
      "sku": {
        "name": "B_Gen5_2",
        "tier": "Basic"
      }
    },
    "targetDbServerMetadata": {
      "location": "westus",
      "version": "16",
      "storageMb": 2048,
      "sku": {
        "tier": "GeneralPurpose",
        "name": "Standard_D4ds_v5"
      }
    },
    "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource",
    "targetDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/flexibleServers/exampletarget",
    "dbsToMigrate": [
      "exampledatabase1",
      "exampledatabase2",
      "exampledatabase3",
      "exampledatabase4"
    ],
    "setupLogicalReplicationOnSourceDbIfNeeded": "True",
    "overwriteDbsInTarget": "False",
    "migrationWindowStartTimeInUtc": "2024-08-01T20:30:22.123456Z",
    "startDataMigration": "False",
    "triggerCutover": "False",
    "migrateRoles": "False"
  },
  "location": "westus",
  "id": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/flexibleServers/exampletarget/migrations/examplemigration",
  "name": "examplemigration",
  "type": "Microsoft.DBForPostgreSql/flexibleServers/migrations"
}

Definitions

Name Description
AdminCredentials

Credentials of administrator users for source and target servers.

CancelEnum

Indicates if cancel must be triggered for the entire migration.

createdByType

The type of identity that created the resource.

DbLevelValidationStatus

Validation status summary for a database.

DbMigrationStatus

Migration status of a database.

DbServerMetadata

Database server metadata.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

LogicalReplicationOnSourceDbEnum

Indicates whether to setup LogicalReplicationOnSourceDb, if needed.

MigrateRolesEnum

Indicates if roles and permissions must be migrated.

MigrationDbState

Migration state of a database.

MigrationMode

Mode used to perform the migration: Online or Offline.

MigrationOption

Supported option for a migration

MigrationResource

Migration.

MigrationResourceForPatch

Migration.

MigrationSecretParameters

Migration secret parameters.

MigrationState

State of migration.

MigrationStatus

State of migration.

MigrationSubState

Substate of migration.

MigrationSubStateDetails

Details of migration substate.

OverwriteDbsInTargetEnum

Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation.

ServerSku

Compute information of a flexible server.

SkuTier

This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT.

SourceType

Source server type used for the migration: ApsaraDB_RDS, AWS, AWS_AURORA, AWS_EC2, AWS_RDS, AzureVM, Crunchy_PostgreSQL, Digital_Ocean_Droplets, Digital_Ocean_PostgreSQL, EDB, EDB_Oracle_Server, EDB_PostgreSQL, GCP, GCP_AlloyDB, GCP_CloudSQL, GCP_Compute, Heroku_PostgreSQL, Huawei_Compute, Huawei_RDS, OnPremises, PostgreSQLCosmosDB, PostgreSQLFlexibleServer, PostgreSQLSingleServer, or Supabase_PostgreSQL

SslMode

SSL mode used by a migration. Default SSL mode for 'PostgreSQLSingleServer' is 'VerifyFull'. Default SSL mode for other source types is 'Prefer'.

StartDataMigrationEnum

Indicates if data migration must start right away.

systemData

Metadata pertaining to creation and last modification of the resource.

TriggerCutoverEnum

Indicates if cutover must be triggered for the entire migration.

ValidationDetails

Details for the validation for migration.

ValidationMessage

Validation message object.

ValidationState

Validation status for migration.

ValidationSummaryItem

Validation summary object.

AdminCredentials

Credentials of administrator users for source and target servers.

Name Type Description
sourceServerPassword

string

Password for the user of the source server.

targetServerPassword

string

Password for the user of the target server.

CancelEnum

Indicates if cancel must be triggered for the entire migration.

Value Description
False
True

createdByType

The type of identity that created the resource.

Value Description
Application
Key
ManagedIdentity
User

DbLevelValidationStatus

Validation status summary for a database.

Name Type Description
databaseName

string

Name of database.

endedOn

string (date-time)

End time of a database level validation.

startedOn

string (date-time)

Start time of a database level validation.

summary

ValidationSummaryItem[]

Summary of database level validations.

DbMigrationStatus

Migration status of a database.

Name Type Description
appliedChanges

integer (int32)

Change Data Capture applied changes counter.

cdcDeleteCounter

integer (int32)

Change Data Capture delete counter.

cdcInsertCounter

integer (int32)

Change Data Capture insert counter.

cdcUpdateCounter

integer (int32)

Change Data Capture update counter.

databaseName

string

Name of database.

endedOn

string (date-time)

End time of a migration state.

fullLoadCompletedTables

integer (int32)

Number of tables loaded during the migration of a database.

fullLoadErroredTables

integer (int32)

Number of tables encountering errors during the migration of a database.

fullLoadLoadingTables

integer (int32)

Number of tables loading during the migration of a database.

fullLoadQueuedTables

integer (int32)

Number of tables queued for the migration of a database.

incomingChanges

integer (int32)

Change Data Capture incoming changes counter.

latency

integer (int32)

Lag in seconds between source and target during online phase.

message

string

Error message, if any, for the migration state.

migrationOperation

string

Migration operation of a database.

migrationState

MigrationDbState

Migration state of a database.

startedOn

string (date-time)

Start time of a migration state.

DbServerMetadata

Database server metadata.

Name Type Description
location

string

Location of database server.

sku

ServerSku

Compute tier and size of the database server. This object is empty for an Azure Database for PostgreSQL single server.

storageMb

integer (int32)

Storage size (in MB) for database server.

version

string

Major version of PostgreSQL database engine.

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response

Name Type Description
error

ErrorDetail

The error object.

LogicalReplicationOnSourceDbEnum

Indicates whether to setup LogicalReplicationOnSourceDb, if needed.

Value Description
False
True

MigrateRolesEnum

Indicates if roles and permissions must be migrated.

Value Description
False
True

MigrationDbState

Migration state of a database.

Value Description
Canceled
Canceling
Failed
InProgress
Succeeded
WaitingForCutoverTrigger

MigrationMode

Mode used to perform the migration: Online or Offline.

Value Description
Offline
Online

MigrationOption

Supported option for a migration

Value Description
Migrate
Validate
ValidateAndMigrate

MigrationResource

Migration.

Name Type Description
id

string (arm-id)

Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"

location

string

The geo-location where the resource lives

name

string

The name of the resource

properties.cancel

CancelEnum

Indicates if cancel must be triggered for the entire migration.

properties.currentStatus

MigrationStatus

Current status of a migration.

properties.dbsToCancelMigrationOn

string[]

When you want to trigger cancel for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array.

properties.dbsToMigrate

string[]

Names of databases to migrate.

properties.dbsToTriggerCutoverOn

string[]

When you want to trigger cutover for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array.

properties.migrateRoles

MigrateRolesEnum

Indicates if roles and permissions must be migrated.

properties.migrationId

string

Identifier of a migration.

properties.migrationInstanceResourceId

string (arm-id)

Identifier of the private endpoint migration instance.

properties.migrationMode

MigrationMode

Mode used to perform the migration: Online or Offline.

properties.migrationOption

MigrationOption

Supported option for a migration.

properties.migrationWindowEndTimeInUtc

string (date-time)

End time (UTC) for migration window.

properties.migrationWindowStartTimeInUtc

string (date-time)

Start time (UTC) for migration window.

properties.overwriteDbsInTarget

OverwriteDbsInTargetEnum

Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation.

properties.secretParameters

MigrationSecretParameters

Migration secret parameters.

properties.setupLogicalReplicationOnSourceDbIfNeeded

LogicalReplicationOnSourceDbEnum

Indicates whether to setup LogicalReplicationOnSourceDb, if needed.

properties.sourceDbServerFullyQualifiedDomainName

string

Fully qualified domain name (FQDN) or IP address of the source server. This property is optional. When provided, the migration service will always use it to connect to the source server.

properties.sourceDbServerMetadata

DbServerMetadata

Metadata of source database server.

properties.sourceDbServerResourceId

string

Identifier of the source database server resource, when 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to ipaddress:port@username or hostname:port@username.

properties.sourceType

SourceType

Source server type used for the migration: ApsaraDB_RDS, AWS, AWS_AURORA, AWS_EC2, AWS_RDS, AzureVM, Crunchy_PostgreSQL, Digital_Ocean_Droplets, Digital_Ocean_PostgreSQL, EDB, EDB_Oracle_Server, EDB_PostgreSQL, GCP, GCP_AlloyDB, GCP_CloudSQL, GCP_Compute, Heroku_PostgreSQL, Huawei_Compute, Huawei_RDS, OnPremises, PostgreSQLCosmosDB, PostgreSQLFlexibleServer, PostgreSQLSingleServer, or Supabase_PostgreSQL

properties.sslMode

SslMode

SSL mode used by a migration. Default SSL mode for 'PostgreSQLSingleServer' is 'VerifyFull'. Default SSL mode for other source types is 'Prefer'.

properties.startDataMigration

StartDataMigrationEnum

Indicates if data migration must start right away.

properties.targetDbServerFullyQualifiedDomainName

string

Fully qualified domain name (FQDN) or IP address of the target server. This property is optional. When provided, the migration service will always use it to connect to the target server.

properties.targetDbServerMetadata

DbServerMetadata

Metadata of target database server.

properties.targetDbServerResourceId

string

Identifier of the target database server resource.

properties.triggerCutover

TriggerCutoverEnum

Indicates if cutover must be triggered for the entire migration.

systemData

systemData

Azure Resource Manager metadata containing createdBy and modifiedBy information.

tags

object

Resource tags.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

MigrationResourceForPatch

Migration.

Name Type Description
properties.cancel

CancelEnum

Indicates if cancel must be triggered for the entire migration.

properties.dbsToCancelMigrationOn

string[]

When you want to trigger cancel for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array.

properties.dbsToMigrate

string[]

Names of databases to migrate.

properties.dbsToTriggerCutoverOn

string[]

When you want to trigger cutover for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array.

properties.migrateRoles

MigrateRolesEnum

Indicates if roles and permissions must be migrated.

properties.migrationMode

MigrationMode

Mode used to perform the migration: Online or Offline.

properties.migrationWindowStartTimeInUtc

string (date-time)

Start time (UTC) for migration window.

properties.overwriteDbsInTarget

OverwriteDbsInTargetEnum

Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation.

properties.secretParameters

MigrationSecretParameters

Migration secret parameters.

properties.setupLogicalReplicationOnSourceDbIfNeeded

LogicalReplicationOnSourceDbEnum

Indicates whether to setup LogicalReplicationOnSourceDb, if needed.

properties.sourceDbServerFullyQualifiedDomainName

string

Fully qualified domain name (FQDN) or IP address of the source server. This property is optional. When provided, the migration service will always use it to connect to the source server.

properties.sourceDbServerResourceId

string

Identifier of the source database server resource, when 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to ipaddress:port@username or hostname:port@username.

properties.startDataMigration

StartDataMigrationEnum

Indicates if data migration must start right away.

properties.targetDbServerFullyQualifiedDomainName

string

Fully qualified domain name (FQDN) or IP address of the target server. This property is optional. When provided, the migration service will always use it to connect to the target server.

properties.triggerCutover

TriggerCutoverEnum

Indicates if cutover must be triggered for the entire migration.

tags

object

Application-specific metadata in the form of key-value pairs.

MigrationSecretParameters

Migration secret parameters.

Name Type Description
adminCredentials

AdminCredentials

Credentials of administrator users for source and target servers.

sourceServerUsername

string

Gets or sets the name of the user for the source server. This user doesn't need to be an administrator.

targetServerUsername

string

Gets or sets the name of the user for the target server. This user doesn't need to be an administrator.

MigrationState

State of migration.

Value Description
Canceled
CleaningUp
Failed
InProgress
Succeeded
ValidationFailed
WaitingForUserAction

MigrationStatus

State of migration.

Name Type Description
currentSubStateDetails

MigrationSubStateDetails

Current migration sub state details.

error

string

Error message, if any, for the migration state.

state

MigrationState

State of migration.

MigrationSubState

Substate of migration.

Value Description
CancelingRequestedDBMigrations
Completed
CompletingMigration
MigratingData
PerformingPreRequisiteSteps
ValidationInProgress
WaitingForCutoverTrigger
WaitingForDBsToMigrateSpecification
WaitingForDataMigrationScheduling
WaitingForDataMigrationWindow
WaitingForLogicalReplicationSetupRequestOnSourceDB
WaitingForTargetDBOverwriteConfirmation

MigrationSubStateDetails

Details of migration substate.

Name Type Description
currentSubState

MigrationSubState

Substate of migration.

dbDetails

<string,  DbMigrationStatus>

validationDetails

ValidationDetails

Details for the validation for migration.

OverwriteDbsInTargetEnum

Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation.

Value Description
False
True

ServerSku

Compute information of a flexible server.

Name Type Description
name

string

Compute tier and size of the database server. This object is empty for an Azure Database for PostgreSQL single server.

tier

SkuTier

Tier of the compute assigned to a flexible server.

SkuTier

This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT.

Value Description
Basic
Free
Premium
Standard

SourceType

Source server type used for the migration: ApsaraDB_RDS, AWS, AWS_AURORA, AWS_EC2, AWS_RDS, AzureVM, Crunchy_PostgreSQL, Digital_Ocean_Droplets, Digital_Ocean_PostgreSQL, EDB, EDB_Oracle_Server, EDB_PostgreSQL, GCP, GCP_AlloyDB, GCP_CloudSQL, GCP_Compute, Heroku_PostgreSQL, Huawei_Compute, Huawei_RDS, OnPremises, PostgreSQLCosmosDB, PostgreSQLFlexibleServer, PostgreSQLSingleServer, or Supabase_PostgreSQL

Value Description
AWS
AWS_AURORA
AWS_EC2
AWS_RDS
AzureVM
EDB
GCP
GCP_AlloyDB
GCP_CloudSQL
GCP_Compute
OnPremises
PostgreSQLSingleServer

SslMode

SSL mode used by a migration. Default SSL mode for 'PostgreSQLSingleServer' is 'VerifyFull'. Default SSL mode for other source types is 'Prefer'.

Value Description
Prefer
Require
VerifyCA
VerifyFull

StartDataMigrationEnum

Indicates if data migration must start right away.

Value Description
False
True

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string (date-time)

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string (date-time)

The timestamp of resource last modification (UTC)

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.

TriggerCutoverEnum

Indicates if cutover must be triggered for the entire migration.

Value Description
False
True

ValidationDetails

Details for the validation for migration.

Name Type Description
dbLevelValidationDetails

DbLevelValidationStatus[]

Details of server level validations.

serverLevelValidationDetails

ValidationSummaryItem[]

Details of server level validations.

status

ValidationState

Validation status for migration.

validationEndTimeInUtc

string (date-time)

End time (UTC) for validation.

validationStartTimeInUtc

string (date-time)

Start time (UTC) for validation.

ValidationMessage

Validation message object.

Name Type Description
message

string

Validation message string.

state

ValidationState

Severity of validation message.

ValidationState

Validation status for migration.

Value Description
Failed
Succeeded
Warning

ValidationSummaryItem

Validation summary object.

Name Type Description
messages

ValidationMessage[]

Validation messages.

state

ValidationState

Validation status for migration.

type

string

Validation type.