{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-sql-database/json-schema/microsoft-azure-sql-database-managed-database-update-schema.json",
  "title": "ManagedDatabaseUpdate",
  "description": "An managed database update.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-sql-database-manageddatabases-api-openapi.yml#/components/schemas/ManagedDatabaseUpdate",
  "type": "object",
  "properties": {
    "properties": {
      "$ref": "#/$defs/ManagedDatabaseProperties",
      "description": "Resource properties.",
      "x-ms-client-flatten": true
    },
    "tags": {
      "type": "object",
      "description": "Resource tags.",
      "additionalProperties": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "CatalogCollationType": {
      "type": "string",
      "description": "Collation of the metadata catalog.",
      "enum": [
        "DATABASE_DEFAULT",
        "SQL_Latin1_General_CP1_CI_AS"
      ],
      "x-ms-enum": {
        "name": "CatalogCollationType",
        "modelAsString": true,
        "values": [
          {
            "name": "DATABASE_DEFAULT",
            "value": "DATABASE_DEFAULT",
            "description": "DATABASE_DEFAULT"
          },
          {
            "name": "SQL_Latin1_General_CP1_CI_AS",
            "value": "SQL_Latin1_General_CP1_CI_AS",
            "description": "SQL_Latin1_General_CP1_CI_AS"
          }
        ]
      }
    },
    "InaccessibilityReason": {
      "type": "string",
      "description": "Root cause kind. Allowed values are “TransparentDataEncryption”, “DatabaseReplication”, and “Unknown”.",
      "enum": [
        "Unknown",
        "TransparentDataEncryption",
        "DatabaseReplication"
      ],
      "x-ms-enum": {
        "name": "InaccessibilityReason",
        "modelAsString": true,
        "values": [
          {
            "name": "Unknown",
            "value": "Unknown",
            "description": "Unknown"
          },
          {
            "name": "TransparentDataEncryption",
            "value": "TransparentDataEncryption",
            "description": "TransparentDataEncryption"
          },
          {
            "name": "DatabaseReplication",
            "value": "DatabaseReplication",
            "description": "DatabaseReplication"
          }
        ]
      }
    },
    "ManagedDatabaseCreateMode": {
      "type": "string",
      "description": "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).",
      "enum": [
        "Default",
        "RestoreExternalBackup",
        "PointInTimeRestore",
        "Recovery",
        "RestoreLongTermRetentionBackup"
      ],
      "x-ms-enum": {
        "name": "ManagedDatabaseCreateMode",
        "modelAsString": true,
        "values": [
          {
            "name": "Default",
            "value": "Default",
            "description": "Default"
          },
          {
            "name": "RestoreExternalBackup",
            "value": "RestoreExternalBackup",
            "description": "RestoreExternalBackup"
          },
          {
            "name": "PointInTimeRestore",
            "value": "PointInTimeRestore",
            "description": "PointInTimeRestore"
          },
          {
            "name": "Recovery",
            "value": "Recovery",
            "description": "Recovery"
          },
          {
            "name": "RestoreLongTermRetentionBackup",
            "value": "RestoreLongTermRetentionBackup",
            "description": "RestoreLongTermRetentionBackup"
          }
        ]
      }
    },
    "ManagedDatabaseExtendedAccessibilityInfo": {
      "type": "object",
      "description": "Managed Database Extended Accessibility Information",
      "properties": {
        "inaccessibilityReasonErrorCode": {
          "type": "string",
          "description": "SQL Server error code connected to the inaccessibility root cause.",
          "readOnly": true
        },
        "inaccessibilityReasonDescription": {
          "type": "string",
          "description": "Root cause explanation and mitigation action.",
          "readOnly": true
        },
        "inaccessibilityReasonKind": {
          "$ref": "#/$defs/InaccessibilityReason",
          "description": "Root cause kind. Allowed values are “TransparentDataEncryption”, “DatabaseReplication”, and “Unknown”.",
          "readOnly": true
        },
        "inaccessibilityReasonTdeKeyUri": {
          "type": "string",
          "description": "For the root cause kind “TransparentDataEncryption”, the CMK URI.",
          "readOnly": true
        }
      },
      "required": [
        "inaccessibilityReasonErrorCode",
        "inaccessibilityReasonDescription",
        "inaccessibilityReasonKind"
      ]
    },
    "ManagedDatabaseProperties": {
      "type": "object",
      "description": "The managed database's properties.",
      "properties": {
        "collation": {
          "type": "string",
          "description": "Collation of the managed database.",
          "x-ms-mutability": [
            "read",
            "create"
          ]
        },
        "status": {
          "$ref": "#/$defs/ManagedDatabaseStatus",
          "description": "Status of the database.",
          "readOnly": true
        },
        "creationDate": {
          "type": "string",
          "format": "date-time",
          "description": "Creation date of the database.",
          "readOnly": true
        },
        "earliestRestorePoint": {
          "type": "string",
          "format": "date-time",
          "description": "Earliest restore point in time for point in time restore.",
          "readOnly": true
        },
        "restorePointInTime": {
          "type": "string",
          "format": "date-time",
          "description": "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.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "defaultSecondaryLocation": {
          "type": "string",
          "description": "Geo paired region.",
          "readOnly": true
        },
        "catalogCollation": {
          "$ref": "#/$defs/CatalogCollationType",
          "description": "Collation of the metadata catalog.",
          "x-ms-mutability": [
            "read",
            "create"
          ]
        },
        "createMode": {
          "$ref": "#/$defs/ManagedDatabaseCreateMode",
          "description": "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).",
          "x-ms-mutability": [
            "create"
          ]
        },
        "storageContainerUri": {
          "type": "string",
          "description": "Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "sourceDatabaseId": {
          "type": "string",
          "description": "The resource identifier of the source database associated with create operation of this database.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "crossSubscriptionSourceDatabaseId": {
          "type": "string",
          "description": "The resource identifier of the cross-subscription source database associated with create operation of this database.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "restorableDroppedDatabaseId": {
          "type": "string",
          "description": "The restorable dropped database resource id to restore when creating this database.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "crossSubscriptionRestorableDroppedDatabaseId": {
          "type": "string",
          "description": "The restorable cross-subscription dropped database resource id to restore when creating this database.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "storageContainerIdentity": {
          "type": "string",
          "description": "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.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "storageContainerSasToken": {
          "type": "string",
          "description": "Conditional. If createMode is RestoreExternalBackup and storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage container sas token.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "failoverGroupId": {
          "type": "string",
          "description": "Instance Failover Group resource identifier that this managed database belongs to.",
          "readOnly": true
        },
        "recoverableDatabaseId": {
          "type": "string",
          "description": "The resource identifier of the recoverable database associated with create operation of this database.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "longTermRetentionBackupResourceId": {
          "type": "string",
          "description": "The name of the Long Term Retention backup to be used for restore of this managed database.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "autoCompleteRestore": {
          "type": "boolean",
          "description": "Whether to auto complete restore of this managed database.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "lastBackupName": {
          "type": "string",
          "description": "Last backup file name for restore of this managed database.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "crossSubscriptionTargetManagedInstanceId": {
          "type": "string",
          "description": "Target managed instance id used in cross-subscription restore.",
          "x-ms-mutability": [
            "create"
          ]
        },
        "isLedgerOn": {
          "type": "boolean",
          "description": "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.",
          "x-ms-mutability": [
            "read",
            "create"
          ]
        },
        "extendedAccessibilityInfo": {
          "$ref": "#/$defs/ManagedDatabaseExtendedAccessibilityInfo",
          "description": "Additional observability and troubleshooting information for databases in ‘Inaccessible’ state.",
          "readOnly": true
        }
      }
    },
    "ManagedDatabaseStatus": {
      "type": "string",
      "description": "Status of the database.",
      "enum": [
        "Online",
        "Offline",
        "Shutdown",
        "Creating",
        "Inaccessible",
        "Restoring",
        "Updating",
        "Stopping",
        "Stopped",
        "Starting",
        "DbMoving",
        "DbCopying"
      ],
      "x-ms-enum": {
        "name": "ManagedDatabaseStatus",
        "modelAsString": true,
        "values": [
          {
            "name": "Online",
            "value": "Online",
            "description": "Online"
          },
          {
            "name": "Offline",
            "value": "Offline",
            "description": "Offline"
          },
          {
            "name": "Shutdown",
            "value": "Shutdown",
            "description": "Shutdown"
          },
          {
            "name": "Creating",
            "value": "Creating",
            "description": "Creating"
          },
          {
            "name": "Inaccessible",
            "value": "Inaccessible",
            "description": "Inaccessible"
          },
          {
            "name": "Restoring",
            "value": "Restoring",
            "description": "Restoring"
          },
          {
            "name": "Updating",
            "value": "Updating",
            "description": "Updating"
          },
          {
            "name": "Stopping",
            "value": "Stopping",
            "description": "Stopping"
          },
          {
            "name": "Stopped",
            "value": "Stopped",
            "description": "Stopped"
          },
          {
            "name": "Starting",
            "value": "Starting",
            "description": "Starting"
          },
          {
            "name": "DbMoving",
            "value": "DbMoving",
            "description": "DbMoving"
          },
          {
            "name": "DbCopying",
            "value": "DbCopying",
            "description": "DbCopying"
          }
        ]
      }
    }
  }
}