Share via


Managed Databases - Create Or Update

Creates a new database or updates an existing database.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}?api-version=2023-08-01

URI Parameters

Name In Required Type Description
databaseName
path True

string

The name of the database.

managedInstanceName
path True

string

The name of the managed instance.

resourceGroupName
path True

string

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

subscriptionId
path True

string

The subscription ID that identifies an Azure subscription.

api-version
query True

string

The API version to use for the request.

Request Body

Name Required Type Description
location True

string

Resource location.

properties.autoCompleteRestore

boolean

Whether to auto complete restore of this managed database.

properties.catalogCollation

CatalogCollationType

Collation of the metadata catalog.

properties.collation

string

Collation of the managed database.

properties.createMode

ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

properties.crossSubscriptionRestorableDroppedDatabaseId

string

The restorable cross-subscription dropped database resource id to restore when creating this database.

properties.crossSubscriptionSourceDatabaseId

string

The resource identifier of the cross-subscription source database associated with create operation of this database.

properties.crossSubscriptionTargetManagedInstanceId

string

Target managed instance id used in cross-subscription restore.

properties.isLedgerOn

boolean

Whether or not this database is a ledger database, which means all tables in the database are ledger tables. Note: the value of this property cannot be changed after the database has been created.

properties.lastBackupName

string

Last backup file name for restore of this managed database.

properties.longTermRetentionBackupResourceId

string

The name of the Long Term Retention backup to be used for restore of this managed database.

properties.recoverableDatabaseId

string

The resource identifier of the recoverable database associated with create operation of this database.

properties.restorableDroppedDatabaseId

string

The restorable dropped database resource id to restore when creating this database.

properties.restorePointInTime

string (date-time)

Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.

properties.sourceDatabaseId

string

The resource identifier of the source database associated with create operation of this database.

properties.storageContainerIdentity

string

Conditional. If createMode is RestoreExternalBackup, this value is used. Specifies the identity used for storage container authentication. Can be 'SharedAccessSignature' or 'ManagedIdentity'; if not specified 'SharedAccessSignature' is assumed.

properties.storageContainerSasToken

string

Conditional. If createMode is RestoreExternalBackup and storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage container sas token.

properties.storageContainerUri

string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.

tags

object

Resource tags.

Responses

Name Type Description
200 OK

ManagedDatabase

Successfully updated the database.

201 Created

ManagedDatabase

Successfully created the database.

202 Accepted

Accepted

Headers

Location: string

Other Status Codes

ErrorResponse

*** Error Responses: ***

  • 400 ManagedInstanceStoppingOrStopped - Conflicting operation submitted while instance is in stopping/stopped state

  • 400 ManagedInstanceStarting - Conflicting operation submitted while instance is in starting state

  • 400 AkvEndpointNotReachableFromNode - AKV endpoint '{0}' is not reachable from SQL, on server '{1}'.

  • 400 CurrentDatabaseSizeExceedsMaxSize - User attempted to reduce the max size for a database to a size smaller than the current usage.

  • 400 PasswordNotComplex - The provided password is not complex enough.

  • 400 InvalidServerName - Invalid server name specified.

  • 400 CannotUpdateIsLedgerDatabase - The ledger property of an existing database cannot be updated.

  • 400 UnsupportedServiceName - The specified name is an invalid name because it contains one or more unsupported unicode characters.

  • 400 TokenTooLong - The provided token is too long.

  • 400 RegionDoesNotSupportVersion - A user attempted to create a server of a specified version in a location where that server version isn't supported.

  • 400 ManagedDatabaseNameInUse - Database '{0}' already exists. Choose a different database name.

  • 400 PitrPointInTimeInvalid - The point in time {0} is not valid. Valid point in time range from {1} days early to now and not before source server creation time.

  • 400 NoMoreSpaceInManagedInstance - The managed instance has reached its storage limit. The storage usage for the managed instance cannot exceed (%d) MBs.

  • 400 CurrentDatabaseLogSizeExceedsMaxSize - User attempted to change the database to a sku with lower max log size than the current usage.

  • 400 CannotUseTrailingWhitespacesInDatabaseName - The database name validation failed.

  • 400 StorageAccountFull - Managed Instance has reached the total capacity of underlying Azure storage account. Azure Premium Storage account is limited to 35TB of allocated space.

  • 400 SameKeyMaterialNotFoundOnRemoteServer - Secondary server does not have the key material of the primary server's encryption protector.

  • 400 ServerNotFound - The requested server was not found.

  • 400 SourceServerNotFound - The server part of a source database id provided in a CreateDatabaseAsCopy API call doesn't map to an existing server.

  • 400 ManagedInstanceStoppingOrStopped - Conflicting operation submitted while instance is in stopping/stopped state

  • 400 InvalidBackupRetentionPeriod - The retention days of {0} is not a valid configuration. Valid backup retention in days must be between {1} and {2}

  • 400 ManagedInstanceStarting - Conflicting operation submitted while instance is in starting state

  • 400 SourceDatabaseNotFound - The source database does not exist.

  • 400 DatabaseNumberLimitReached - Maximum number of databases for SQL Database Managed Instance reached.

  • 400 InvalidCollation - Collation is not recognized by the server.

  • 400 ManagedInstanceUpdateSloInProgress - "The operation could not be completed because a service tier change is in progress for managed instance '{0}.' Please wait for the operation in progress to complete and try again."

  • 400 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

  • 400 AkvHostNotResolvingFromNode - AKV host '{0}' is not resolvable from SQL, on server '{1}'.

  • 400 InvalidDatabaseCreateOrUpdateRequest - The request body for the create or update database operation is invalid.

  • 400 InvalidResourceId - Invalid resource identifier.

  • 400 InvalidSourceDatabaseId - Invalid source database identifier.

  • 400 InvalidRestorableDroppedDatabaseId - Invalid restorable dropped database identifier

  • 400 InvalidCrossSubscriptionTargetManagedInstanceId - Invalid cross subscription target managed instance identifier.

  • 400 MismatchingResourceGroupNameWithUrl - The provided resource group name did not match the name in the Url.

  • 400 MismatchingServerNameWithUrl - The provided server name did not match the name in the Url.

  • 400 MismatchingSubscriptionWithUrl - The provided subscription did not match the subscription in the Url.

  • 400 MissingCollation - Collation is required.

  • 400 MissingSourceDatabaseId - Missing source database identifier.

  • 400 MissingRestorePointInTime - Missing restore point in time

  • 400 MissingStorageContainerSasToken - Missing storage container SAS token

  • 400 MissingStorageContainerUri - Missing storage container URI

  • 400 RestorableDroppedDatabaseIdGivenForRestoreWithSourceDatabaseId - Cannot specify restorableDroppedDatabaseId when sourceDatabaseId is already given in restore create mode

  • 400 CrossSubscriptionRestorableDroppedDatabaseIdGivenForRestoreWithCrossSubscriptionSourceDatabaseId - Cannot specify crossSubscriptionRestorableDroppedDatabaseId when crossSubscriptionSourceDatabaseId is already given.

  • 400 MissmatchingCrossSubscriptionTargetManagedInstanceIdWithUrl - The provided crossSubscriptionTargetManagedInstanceId must match the instance in the URL.

  • 400 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

  • 400 InvalidLongTermRetentionManagedInstanceBackupId - Invalid long term retention backup identifier for Managed Instances.

  • 400 LongTermRetentiontBackupOperationResultsInvalidODataQuery - The specified OData query is either not valid or not supported

  • 400 LongTermRetentionMigrationRequestNotSupported - Subscription is not allowed LTR backup Migration feature.

  • 400 LongTermRetentionMigrationCrossClusterRequestNotSupported - Source and target subscriptions are not allowed to communicate for LTR backup copy feature.

  • 400 LongTermRetentionMigrationParameterMissing - Required parameter missing for the operation.

  • 400 LongTermRetentionMigrationSameServerNotSupported - LTR Copy feature is not supported to copy LTR backups within same server.

  • 400 LongTermRetentionMigrationTargetServerNotFound - Target server does not exists or is not ready for LTR backup copy operation.

  • 400 LongTermRetentionMigrationTargetDatabaseNotFound - Target Database does not exists on the server.

  • 400 LongTermRetentionMigrationStorageTypeNotSupported - Specified Backup Storage Redundancy is not supported in target region.

  • 400 LongTermRetentionMigrationStorageMismatch - Active backup redundancy of database does not match backup redundancy requested by customer.

  • 400 LtrOperationFailedBackupImmutable - Deleting Long Term Retention backup failed because the backup is immutable.

  • 400 LongTermRetentionMigrationDatabaseTypeNotSupported - LTR migration is only supported for managed instance and Azure SQL DB LTR backups.

  • 400 LongTermRetentionMigrationBackupStorageRedundancyNotAllowed - Changing backup storage redundancy is not allowed for LTR Copy operations.

  • 400 LtrRestoreFailedArchiveStorageTier - Restoring archived long-term retention backup is not supported. Restore can be performed only on rehydrated or regular long-term retention backups.

  • 400 LtrArchiveStorageTierNotEnabled - Archiving long-term retention backups is not enabled.

  • 400 LtrArchiveWrongParameters - ChangeLongTermRetentionBackupAccessTier is not supported for the desired (backupStorageAccessTier, operationMode) combination. Only (Archive, Move) and (Hot, Copy) are allowed.

  • 400 LTRArchiveRedundancyChangeFailed - Updating the backup storage redundancy type to zone-redundant storage is not supported when a long-term retention policy with the 'archive' backup storage access tier is set

  • 400 LongTermRetentionMigrationSubscriptionNotFound - The subscription could not be found.

  • 400 ManagementServiceManagedServerDisabled - Operation failed since Managed Instance '{0}' is disabled. Please enable Managed Instance and try again.

  • 400 MiGeoRestoreWithWrongBackupStorageRedundancy - Geo-Restore is not allowed for managed instances with LRS/ZRS backup storage redundancy.

  • 400 LastBackupNameHasNewline - Please do not use forbidden characters ('\n', '\r') in lastBackupName.

  • 400 LastBackupNameHasNonAsciiCharacter - The operation was aborted because the 'LastBackupName' parameter contains invalid characters. Only ASCII characters are allowed.

  • 400 ProvisioningDisabled - Displays error message from resources operation authorizer as is, without changes

  • 400 LRSCutoverDatabaseDoesNotExist - The operation was aborted because the database name specified in the request doesn't match any database name on the specified server.

  • 400 LRSCutoverDatabaseNotInRestoringState - The operation was aborted because the specified database is not in restoring state.

  • 400 LRSCutoverDatabaseAlreadyRestored - The operation was aborted because the specified database was already restored.

  • 400 LRSCutoverAlreadyInitiated - The operation was aborted because a cutover for the specified database is already in progress.

  • 400 ManagementServiceFeatureDisabled - User attempted to use a feature which is disabled.

  • 400 AadOnlyAuthenticationIsEnabled - Azure Active Directory Only Authentication is enabled. Please contact your system administrator.

  • 400 UpdatingInstanceAndBackupRedundancy - Instance zone redundancy and backup storage redundancy cannot be updated in the same request.

  • 400 DeleteOfManagedInstanceIsDisabled - Delete operation of managed instance is disabled.

  • 400 RequestCantLandOnPaaSv2Platform - Request needs to land on PaaSv2 platform but PaaSv2 is not enabled.

  • 400 CustomMaintenanceWindowIsDisabled - Custom maintenance window is not enabled.

  • 400 DeleteOfVersion2VirtualClusterIsDisabled - Delete of virtual cluster with version 2 is not enabled.

  • 400 DeleteOfVirtualClusterIsDisabled - Delete of virtual cluster is not enabled.

  • 400 MICantBeMovedFromOrToInstancePool - Existing managed instance can't be moved to managed instance pool.

  • 400 DnsRefreshOnVirtualClusterIsDisabled - Refresh of DNS records on virtual cluster is not enabled.

  • 400 TimeoutDuringRestore - A timeout was encountered while trying to connect to the restore target.

  • 400 AutoCompleteMissingLastBackupName - Auto complete restore request must have lastBackupName parameter provided.

  • 400 MissingThumbprint - Can not find server certificate.

  • 400 BlobStorageServerFailure - Blob storage server failure has occurred.

  • 400 BackupSetNotFound - No backups were found to restore the database. Please contact support to restore the database.

  • 400 FullBackupNotFound - Full backup can not be found.

  • 400 RestoreFromStripedBackupsNotEnabled - Restoring from striped backups is not supported.

  • 400 BrokenRestorePlanNoFullBackup - The restore plan is broken because there is no full backup.

  • 400 BrokenRestorePlanWrongLogBackupLSN - The restore plan is broken because firstLsn of current log backup is not <= lastLsn of next log backup.

  • 400 BrokenRestorePlanWrongDiffBackupLSN - The restore plan is broken because firstLsn of diff backup is not >= firstLsn of full backup.

  • 400 BrokenRestorePlanGapInLogBackups - The restore plan is broken because firstLsn of current log backup is not equal to lastLsn of prev log backup.

  • 400 TargetServerDoesNotExist - The target server {0} does not exist or is not ready yet. Please check that it exists and retry the restore request.

  • 400 TargetServerRestoreNotAllowed - The target server {0} is currently not in a state that allows a restore to be started.

  • 400 XtpInitializedDuringRestore - Memory-optimized filegroup must be empty in order to be restored on General Purpose tier of SQL Database Managed Instance.

  • 400 FullBackupMissingChecksum - Provided full backup is missing checksum.

  • 400 FullBackupDamaged - Provided full backup is damaged.

  • 400 MissingStripeInBackupSet - Provided backup set has one or more missing stripes.

  • 400 BackupsFromMultipleDatabasesDetectedInTheContainerWhileRestoreInProgress - There are backups from multiple databases in the container folder. Please make sure the container folder has backups from a single database.{0}

  • 400 BrokenRestorePlanWrongDiffBaseGUID - The restore plan is broken because DifferentialBaseGuid of diff backup does not match BackupSetGuid of full backup.

  • 400 CorruptedPagesInBackupSet - Operation was aborted because RESTORE detected one or more corrupted pages in the backup set.

  • 400 ManagedIdentityIssueDetectedWhileRestoreInProgress - Managed identity is not set up properly. Please verify and try again.

  • 400 CorruptedPagesListMaintenance - Operation was aborted because an internal error occurred while processing the backup taken without checksum.

  • 400 StorageBrokenIssueDetectedWhileInProgress - Storage connection is broken. Retrying automatically...

  • 400 PartiallyContainedDatabaseUnsupported - "Backup for a partially contained database is not supported."

  • 400 RequiredBackupIsNotLastRestored - Migration cannot be completed because provided backup file name is not the name of the last backup file that is restored.

  • 400 ManagedInstanceStorageLimitHit - The managed instance has reached its storage limit.

  • 400 IncompatiblePhysicalLayoutTooFewDataFiles - Database backup contains incompatible physical layout. No data files are found in the backup.

  • 400 IncompatiblePhysicalLayoutNonOnlineDataFilesExist - Database backup contains incompatible physical layout. Non-online data files exist.

  • 400 IncompatiblePhysicalLayoutWrongNumberOfLogFiles - Database backup contains incompatible physical layout. Multiple log files are not supported.

  • 400 IncompatiblePhysicalLayoutNonOnlineLogFilesExist - Database backup contains incompatible physical layout. Non-online log files exist.

  • 400 IncompatiblePhysicalLayoutTooManyNonDataLogFiles - Database backup contains incompatible physical layout. Too many non-data/log files.

  • 400 ExternalBackupAlreadySignaledToComplete - The restore request has already been signaled to complete.

  • 400 ExternalBackupRestoreHasNotBeenStarted - The restore request can only be completed once the restore has started.

  • 400 ExternalBackupUpgradeInProgress - The restore request cannot be completed, since upgrade is in progress.

  • 400 IncompatiblePhysicalLayoutTooManyXTPFiles - Database backup contains incompatible physical layout. Multiple files found in the filegroup that contains MEMORY_OPTIMIZED_DATA.

  • 400 BlobStorageFailure - Blob storage failure has occurred.

  • 400 BackupsFromMultipleDatabasesDetectedInTheContainerFromTheStart - There are backups from multiple databases in the container folder. Please make sure the container folder has backups from a single database.{0}

  • 400 ManagedIdentityIssueDetectedFromTheStart - Managed identity is not set up properly. Please verify and try again.

  • 400 StorageBrokenIssueDetectedAtTheStart - Storage connection is broken. Please verify and try again.

  • 400 StorageBrokenIssueDetectedTerminateRetries - Storage connection is still broken. Please verify and try again.

  • 400 BackupSetBroken - Backup set is broken.

  • 400 SqlRestoreError - Non retriable error occurred while restoring backup.

  • 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

  • 404 SubscriptionDoesNotHaveServer - The requested server was not found

  • 404 ResourceNotFound - The requested resource was not found.

  • 404 CannotFindServerCertificateWithThumbprint - Cannot find server certificate with thumbprint '{0}'. Please use PowerShell Cmdlet 'Add-AzureRmSqlManagedInstanceTransparentDataEncryptionCertificate' to create the certificate.

  • 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

  • 404 ServerNotInSubscription - Specified server does not exist on the specified subscription.

  • 404 RestoreSourceDatabaseNotFound - Could not find database '{0}' at time '{1}' that can be restored.

  • 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

  • 404 CannotFindObject - Cannot find the object because it does not exist or you do not have permissions

  • 404 SubscriptionNotFound - The requested subscription was not found.

  • 404 LongTermRetentionMigrationBackupNotFound - LTR backup specified does not exists.

  • 404 OperationIdNotFound - The operation with Id does not exist.

  • 409 SubscriptionDisabled - Subscription is disabled.

  • 409 ConflictingSystemOperationInProgress - A system maintenance operation is in progress on the database and further operations need to wait until it is completed.

  • 409 RemoteDatabaseExists - The destination database name already exists on the destination server.

  • 409 ConflictingDatabaseOperation - There is already some operation on the database and the current operation should wait till it is done.

  • 409 ManagementServiceDatabaseBusy - Database '{0}' is busy with another operation. Please try your operation later.

  • 409 LongTermRetentionMigrationRequestConflict - A conflict operation on this LTR backup is still in progress.

  • 409 LongTermRetentionMigrationBackupConflict - Another LTR backup with same backup time for target database exists.

  • 409 MiCreateFailedNonDelegatedSubnet - User tried to deploy Managed Instance or Managed Instance pool in subnet that is not delegated to Microsoft.Sql/managedInstances.

  • 409 InstancePoolBusy - An instance pool is busy with another ongoing operation

  • 409 ConflictingManagedInstanceOperation - An operation is currently in progress for the managed instance.

  • 409 BackupRedundancyUpdateAndInstanceRedundancyConflict - The instance is multi-az but backup storage is being updated from zone redundant to non-zone redundant.

  • 409 InstanceRedundancyUpdateWhileBackupRedundancyUpdateInProgress - Cannot update instance redundancy because backup storage redundancy update is in progress.

  • 409 InstanceRedundancyUpdateAndBackupRedundancyConflict - The backup storage is non-zone redundant but instance redundancy is being updated to zone redundant.

  • 409 BackupRedundancyUpdateConflict - Cannot update backup storage redundancy because a backup storage redundancy update is already in progress.

  • 409 MiDropFailedOnAuthLocks - User tried to drop last Managed Instance in subnet that has Lock applied on resource(s).

  • 409 CannotCancelOperation - The management operation is in a state that cannot be cancelled.

  • 409 OperationCancelled - The operation has been cancelled by user.

  • 409 OperationInterrupted - The operation on the resource could not be completed because it was interrupted by another operation on the same resource.

  • 412 InstanceNotReadyForBackupRedundancyUpdate - Cannot update backup storage redundancy because the instance is not ready.

  • 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

  • 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

  • 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

  • 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

  • 429 ConflictingSubscriptionOperation - An operation is currently in progress for the subscription.

  • 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

  • 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

  • 500 ActivateOrDeactivateWorkflowThrottling - Activation or deactivation workflow failed because there are too many concurrent workflows

  • 500 LongTermRetentionMigrationRequestFailedToStartOnTarget - Failed to start LTR backup copy request in target region.

  • 500 LongTermRetentionMigrationRequestCopyFailed - Copy operation failed for LTR backup blobs.

  • 500 LongTermRetentionMigrationRestoreVerExceeded - Restore verification failed after max attempts were reached.

  • 500 LongTermRetentionMigrationRestoreVerFailed - Restore verification failed.

  • 500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.

  • 503 DatabaseUnavailable - The operation failed because the database is unavailable.

  • 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

  • 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

  • 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

  • 504 RequestTimeout - Service request exceeded the allowed timeout.

  • 504 RequestTimeout - Service request exceeded the allowed timeout.

Examples

Creates a new managed database by restoring from an external backup
Creates a new managed database by restoring from an external backup using managed identity
Creates a new managed database from restoring a geo-replicated backup
Creates a new managed database from restoring a long term retention backup
Creates a new managed database using cross subscription point in time restore
Creates a new managed database using point in time restore
Creates a new managed database with ledger on.
Creates a new managed database with maximal properties
Creates a new managed database with minimal properties

Creates a new managed database by restoring from an external backup

Sample request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/databases/managedDatabase?api-version=2023-08-01

{
  "properties": {
    "createMode": "RestoreExternalBackup",
    "storageContainerUri": "https://myaccountname.blob.core.windows.net/backups",
    "storageContainerSasToken": "sv=2015-12-11&sr=c&sp=rl&sig=1234",
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "autoCompleteRestore": true,
    "lastBackupName": "last_backup_name"
  },
  "location": "southeastasia"
}

Sample response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

Creates a new managed database by restoring from an external backup using managed identity

Sample request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/databases/managedDatabase?api-version=2023-08-01

{
  "properties": {
    "createMode": "RestoreExternalBackup",
    "storageContainerUri": "https://myaccountname.blob.core.windows.net/backups",
    "storageContainerIdentity": "ManagedIdentity",
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "autoCompleteRestore": true,
    "lastBackupName": "last_backup_name"
  },
  "location": "southeastasia"
}

Sample response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

Creates a new managed database from restoring a geo-replicated backup

Sample request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/server1/databases/testdb_recovered?api-version=2023-08-01

{
  "location": "southeastasia",
  "properties": {
    "createMode": "Recovery",
    "recoverableDatabaseId": "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb"
  }
}

Sample response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/server1/recoverableDatabases/testdb_recovered",
  "name": "testdb_recovered",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2018-11-07T04:41:33.937Z",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb_recovered",
  "name": "testdb_recovered",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2018-11-07T04:41:33.937Z",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

Creates a new managed database from restoring a long term retention backup

Sample request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/databases/managedDatabase?api-version=2023-08-01

{
  "properties": {
    "createMode": "RestoreExternalBackup",
    "storageContainerUri": "https://myaccountname.blob.core.windows.net/backups",
    "storageContainerSasToken": "sv=2015-12-11&sr=c&sp=rl&sig=1234",
    "collation": "SQL_Latin1_General_CP1_CI_AS"
  },
  "location": "southeastasia"
}

Sample response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

Creates a new managed database using cross subscription point in time restore

Sample request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/databases/managedDatabase?api-version=2023-08-01

{
  "location": "southeastasia",
  "properties": {
    "createMode": "PointInTimeRestore",
    "crossSubscriptionTargetManagedInstanceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr",
    "crossSubscriptionSourceDatabaseId": "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr2/databases/testdb",
    "restorePointInTime": "2017-07-14T05:35:31.503Z"
  }
}

Sample response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

Creates a new managed database using point in time restore

Sample request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/databases/managedDatabase?api-version=2023-08-01

{
  "location": "southeastasia",
  "properties": {
    "createMode": "PointInTimeRestore",
    "sourceDatabaseId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb",
    "restorePointInTime": "2017-07-14T05:35:31.503Z"
  }
}

Sample response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

Creates a new managed database with ledger on.

Sample request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/databases/managedDatabase?api-version=2023-08-01

{
  "location": "southeastasia",
  "properties": {
    "isLedgerOn": true
  }
}

Sample response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testcl/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": true
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testcl/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": true
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
Location: https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/locations/southeastasia/operationStatus/default/operationId/00000000-0000-0000-0000-000000000000?api-version=2022-08-01

Creates a new managed database with maximal properties

Sample request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/databases/managedDatabase?api-version=2023-08-01

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia"
}

Sample response

{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "tags": {
    "tagKey1": "TagValue1"
  },
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
Location: https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/locations/southeastasia/operationStatus/default/operationId/00000000-0000-0000-0000-000000000000?api-version=2017-03-01

Creates a new managed database with minimal properties

Sample request

PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/managedInstance/databases/managedDatabase?api-version=2023-08-01

{
  "location": "southeastasia"
}

Sample response

{
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb1",
  "name": "testdb1",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
{
  "location": "southeastasia",
  "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb2",
  "name": "testdb2",
  "properties": {
    "collation": "SQL_Latin1_General_CP1_CI_AS",
    "status": "Online",
    "creationDate": "2017-06-07T04:41:33.937Z",
    "defaultSecondaryLocation": "North Europe",
    "isLedgerOn": false
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}
Location: https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/locations/southeastasia/operationStatus/default/operationId/00000000-0000-0000-0000-000000000000?api-version=2017-03-01

Definitions

Name Description
CatalogCollationType

Collation of the metadata catalog.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

ManagedDatabase

A managed database resource.

ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

ManagedDatabaseStatus

Status of the database.

CatalogCollationType

Collation of the metadata catalog.

Value Description
DATABASE_DEFAULT
SQL_Latin1_General_CP1_CI_AS

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.

ManagedDatabase

A managed database resource.

Name Type Description
id

string

Resource ID.

location

string

Resource location.

name

string

Resource name.

properties.autoCompleteRestore

boolean

Whether to auto complete restore of this managed database.

properties.catalogCollation

CatalogCollationType

Collation of the metadata catalog.

properties.collation

string

Collation of the managed database.

properties.createMode

ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

properties.creationDate

string (date-time)

Creation date of the database.

properties.crossSubscriptionRestorableDroppedDatabaseId

string

The restorable cross-subscription dropped database resource id to restore when creating this database.

properties.crossSubscriptionSourceDatabaseId

string

The resource identifier of the cross-subscription source database associated with create operation of this database.

properties.crossSubscriptionTargetManagedInstanceId

string

Target managed instance id used in cross-subscription restore.

properties.defaultSecondaryLocation

string

Geo paired region.

properties.earliestRestorePoint

string (date-time)

Earliest restore point in time for point in time restore.

properties.failoverGroupId

string

Instance Failover Group resource identifier that this managed database belongs to.

properties.isLedgerOn

boolean

Whether or not this database is a ledger database, which means all tables in the database are ledger tables. Note: the value of this property cannot be changed after the database has been created.

properties.lastBackupName

string

Last backup file name for restore of this managed database.

properties.longTermRetentionBackupResourceId

string

The name of the Long Term Retention backup to be used for restore of this managed database.

properties.recoverableDatabaseId

string

The resource identifier of the recoverable database associated with create operation of this database.

properties.restorableDroppedDatabaseId

string

The restorable dropped database resource id to restore when creating this database.

properties.restorePointInTime

string (date-time)

Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database.

properties.sourceDatabaseId

string

The resource identifier of the source database associated with create operation of this database.

properties.status

ManagedDatabaseStatus

Status of the database.

properties.storageContainerIdentity

string

Conditional. If createMode is RestoreExternalBackup, this value is used. Specifies the identity used for storage container authentication. Can be 'SharedAccessSignature' or 'ManagedIdentity'; if not specified 'SharedAccessSignature' is assumed.

properties.storageContainerSasToken

string

Conditional. If createMode is RestoreExternalBackup and storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage container sas token.

properties.storageContainerUri

string

Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.

tags

object

Resource tags.

type

string

Resource type.

ManagedDatabaseCreateMode

Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup (longTermRetentionBackupResourceId required).

Value Description
Default
PointInTimeRestore
Recovery
RestoreExternalBackup
RestoreLongTermRetentionBackup

ManagedDatabaseStatus

Status of the database.

Value Description
Creating
DbCopying
DbMoving
Inaccessible
Offline
Online
Restoring
Shutdown
Starting
Stopped
Stopping
Updating