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=2021-11-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.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

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.storageContainerSasToken

string

Conditional. If createMode is RestoreExternalBackup, 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

Other Status Codes

*** Error Responses: ***

  • 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 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 AkvHostNotResolvingFromNode - AKV host '{0}' is not resolvable from SQL, on server '{1}'.

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

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

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

  • 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 SameKeyMaterialNotFoundOnRemoteServer - Secondary server does not have the key material of the primary server's encryption protector.

  • 400 SourceDatabaseNotFound - The source database does not exist.

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

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

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

  • 400 InvalidServerName - Invalid server name specified.

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

  • 400 TokenTooLong - The provided token is too long.

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

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

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

  • 400 ServerNotFound - The requested server was not found.

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

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

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

  • 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 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 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

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

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

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

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

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

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

  • 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 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 MissingThumbprint - Can not find server certificate.

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

  • 400 BackupSetBroken - Backup set is broken.

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

  • 400 SqlRestoreError - Non retriable error occurred while restoring backup with index {0} - {1} {2}

  • 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 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 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 BrokenRestorePlanWrongDiffBaseGUID - The restore plan is broken because DifferentialBaseGuid of diff backup does not match BackupSetGuid of full backup.

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

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

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

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

  • 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 ManagedInstanceStorageLimitHit - The managed instance has reached its storage limit.

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

  • 400 BlobStorageServerFailure - Blob storage server failure has occurred.

  • 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 ManagedIdentityIssueDetectedWhileRestoreInProgress - Managed identity is not set up properly. Please verify and try again.

  • 404 SubscriptionDoesNotHaveServer - The requested server was not found

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

  • 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 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 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

  • 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 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

  • 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 SubscriptionDisabled - Subscription is disabled.

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

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

  • 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 MiCreateFailedNonDelegatedSubnet - User tried to deploy Managed Instance or Managed Instance pool in subnet that is not delegated to Microsoft.Sql/managedInstances.

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

  • 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 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.

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

  • 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.

  • 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 from restoring a geo-replicated backup
Creates a new managed database from restoring a long term retention backup
Creates a new managed database using point in time restore
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=2021-11-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"
  },
  "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"
  },
  "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=2021-11-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"
  },
  "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"
  },
  "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=2021-11-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"
  },
  "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"
  },
  "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=2021-11-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"
  },
  "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"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

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=2021-11-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"
  },
  "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"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

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=2021-11-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"
  },
  "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"
  },
  "type": "Microsoft.Sql/managedInstances/databases"
}

Definitions

Name Description
CatalogCollationType

Collation of the metadata catalog.

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.

Name Type Description
DATABASE_DEFAULT

string

SQL_Latin1_General_CP1_CI_AS

string

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

Creation date of the database.

properties.defaultSecondaryLocation

string

Geo paired region.

properties.earliestRestorePoint

string

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.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

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.storageContainerSasToken

string

Conditional. If createMode is RestoreExternalBackup, 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).

Name Type Description
Default

string

PointInTimeRestore

string

Recovery

string

RestoreExternalBackup

string

RestoreLongTermRetentionBackup

string

ManagedDatabaseStatus

Status of the database.

Name Type Description
Creating

string

Inaccessible

string

Offline

string

Online

string

Restoring

string

Shutdown

string

Updating

string