Database Class
A database resource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to server.
Constructor
Database(*, location: str, tags: dict[str, str] | None = None, sku: _models.Sku | None = None, identity: _models.DatabaseIdentity | None = None, create_mode: str | _models.CreateMode | None = None, collation: str | None = None, max_size_bytes: int | None = None, sample_name: str | _models.SampleName | None = None, elastic_pool_id: str | None = None, source_database_id: str | None = None, restore_point_in_time: datetime | None = None, source_database_deletion_date: datetime | None = None, recovery_services_recovery_point_id: str | None = None, long_term_retention_backup_resource_id: str | None = None, recoverable_database_id: str | None = None, restorable_dropped_database_id: str | None = None, catalog_collation: str | _models.CatalogCollationType | None = None, zone_redundant: bool | None = None, license_type: str | _models.DatabaseLicenseType | None = None, read_scale: str | _models.DatabaseReadScale | None = None, high_availability_replica_count: int | None = None, secondary_type: str | _models.SecondaryType | None = None, auto_pause_delay: int | None = None, requested_backup_storage_redundancy: str | _models.BackupStorageRedundancy | None = None, min_capacity: float | None = None, maintenance_configuration_id: str | None = None, is_ledger_on: bool | None = None, federated_client_id: str | None = None, keys: dict[str, '_models.DatabaseKey'] | None = None, encryption_protector: str | None = None, preferred_enclave_type: str | _models.AlwaysEncryptedEnclaveType | None = None, use_free_limit: bool | None = None, free_limit_exhaustion_behavior: str | _models.FreeLimitExhaustionBehavior | None = None, source_resource_id: str | None = None, manual_cutover: bool | None = None, perform_cutover: bool | None = None, availability_zone: str | _models.AvailabilityZoneType | None = None, encryption_protector_auto_rotation: bool | None = None, **kwargs: Any)
Keyword-Only Parameters
| Name | Description |
|---|---|
|
location
|
Resource location. Required. |
|
tags
|
Resource tags. Default value: None
|
|
sku
|
The database SKU. The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU
name, tier/edition, family, and capacity) that are available to your subscription in an Azure
region, use the
Default value: None
|
|
identity
|
The Azure Active Directory identity of the database. Default value: None
|
|
create_mode
|
str or
CreateMode
Specifies the mode of database creation. Default: regular database creation. Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Known values are: "Default", "Copy", "Secondary", "PointInTimeRestore", "Restore", "Recovery", "RestoreExternalBackup", "RestoreExternalBackupSecondary", "RestoreLongTermRetentionBackup", and "OnlineSecondary". Default value: None
|
|
collation
|
The collation of the database. Default value: None
|
|
max_size_bytes
|
The max size of the database expressed in bytes. Default value: None
|
|
sample_name
|
str or
SampleName
The name of the sample schema to apply when creating this database. Known values are: "AdventureWorksLT", "WideWorldImportersStd", and "WideWorldImportersFull". Default value: None
|
|
elastic_pool_id
|
The resource identifier of the elastic pool containing this database. Default value: None
|
|
source_database_id
|
The resource identifier of the source database associated with create operation of this database. Default value: None
|
|
restore_point_in_time
|
Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Default value: None
|
|
source_database_deletion_date
|
Specifies the time that the database was deleted. Default value: None
|
|
recovery_services_recovery_point_id
|
The resource identifier of the recovery point associated with create operation of this database. Default value: None
|
|
long_term_retention_backup_resource_id
|
The resource identifier of the long term retention backup associated with create operation of this database. Default value: None
|
|
recoverable_database_id
|
The resource identifier of the recoverable database associated with create operation of this database. Default value: None
|
|
restorable_dropped_database_id
|
The resource identifier of the restorable dropped database associated with create operation of this database. Default value: None
|
|
catalog_collation
|
Collation of the metadata catalog. Known values are: "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS". Default value: None
|
|
zone_redundant
|
Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. Default value: None
|
|
license_type
|
The license type to apply for this database. Default value: None
|
|
read_scale
|
The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool. Known values are: "Enabled" and "Disabled". Default value: None
|
|
high_availability_replica_count
|
The number of secondary replicas associated with the database that are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. Default value: None
|
|
secondary_type
|
str or
SecondaryType
The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby. Known values are: "Geo", "Named", and "Standby". Default value: None
|
|
auto_pause_delay
|
Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. Default value: None
|
|
requested_backup_storage_redundancy
|
The storage account type to be used to store backups for this database. Known values are: "Geo", "Local", "Zone", and "GeoZone". Default value: None
|
|
min_capacity
|
Minimal capacity that database will always have allocated, if not paused. Default value: None
|
|
maintenance_configuration_id
|
Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates will occur. Default value: None
|
|
is_ledger_on
|
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. Default value: None
|
|
federated_client_id
|
The Client id used for cross tenant per database CMK scenario. Default value: None
|
|
keys
|
The resource ids of the user assigned identities to use. Default value: None
|
|
encryption_protector
|
The azure key vault URI of the database if it's configured with per Database Customer Managed Keys. Default value: None
|
|
preferred_enclave_type
|
Type of enclave requested on the database i.e. Default or VBS enclaves. Known values are: "Default" and "VBS". Default value: None
|
|
use_free_limit
|
Whether or not the database uses free monthly limits. Allowed on one database in a subscription. Default value: None
|
|
free_limit_exhaustion_behavior
|
Specifies the behavior when monthly free limits are exhausted for the free database. AutoPause: The database will be auto paused upon exhaustion of free limits for remainder of the month. BillForUsage: The database will continue to be online upon exhaustion of free limits and any overage will be billed. Known values are: "AutoPause" and "BillOverUsage". Default value: None
|
|
source_resource_id
|
The resource identifier of the source associated with the create operation of this database. This property is only supported for DataWarehouse edition and allows to restore across subscriptions. When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or existing sql pool, and restorePointInTime must be specified. When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped sql pool. When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool. When source subscription belongs to a different tenant than target subscription, "x-ms-authorization-auxiliary" header must contain authentication token for the source tenant. For more details about "x-ms-authorization-auxiliary" header see https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. Default value: None
|
|
manual_cutover
|
Whether or not customer controlled manual cutover needs to be done during Update Database operation to Hyperscale tier. This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to Hyperscale tier. When manualCutover is specified, the scaling operation will wait for user input to trigger cutover to Hyperscale database. To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in Waiting state. Default value: None
|
|
perform_cutover
|
To trigger customer controlled manual cutover during the wait state while Scaling operation is in progress. This property parameter is only applicable for scaling operations that are initiated along with 'manualCutover' parameter. This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to Hyperscale tier is already in progress. When performCutover is specified, the scaling operation will trigger cutover and perform role-change to Hyperscale database. Default value: None
|
|
availability_zone
|
Specifies the availability zone the database is pinned to. Known values are: "NoPreference", "1", "2", and "3". Default value: None
|
|
encryption_protector_auto_rotation
|
The flag to enable or disable auto rotation of database encryption protector AKV key. Default value: None
|
Variables
| Name | Description |
|---|---|
|
id
|
Resource ID. |
|
name
|
Resource name. |
|
type
|
Resource type. |
|
location
|
Resource location. Required. |
|
tags
|
Resource tags. |
|
sku
|
The database SKU. The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU
name, tier/edition, family, and capacity) that are available to your subscription in an Azure
region, use the
|
|
kind
|
Kind of database. This is metadata used for the Azure portal experience. |
|
managed_by
|
Resource that manages the database. |
|
identity
|
The Azure Active Directory identity of the database. |
|
create_mode
|
str or
CreateMode
Specifies the mode of database creation. Default: regular database creation. Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Known values are: "Default", "Copy", "Secondary", "PointInTimeRestore", "Restore", "Recovery", "RestoreExternalBackup", "RestoreExternalBackupSecondary", "RestoreLongTermRetentionBackup", and "OnlineSecondary". |
|
collation
|
The collation of the database. |
|
max_size_bytes
|
The max size of the database expressed in bytes. |
|
sample_name
|
str or
SampleName
The name of the sample schema to apply when creating this database. Known values are: "AdventureWorksLT", "WideWorldImportersStd", and "WideWorldImportersFull". |
|
elastic_pool_id
|
The resource identifier of the elastic pool containing this database. |
|
source_database_id
|
The resource identifier of the source database associated with create operation of this database. |
|
status
|
The status of the database. Known values are: "Online", "Restoring", "RecoveryPending", "Recovering", "Suspect", "Offline", "Standby", "Shutdown", "EmergencyMode", "AutoClosed", "Copying", "Creating", "Inaccessible", "OfflineSecondary", "Pausing", "Paused", "Resuming", "Scaling", "OfflineChangingDwPerformanceTiers", "OnlineChangingDwPerformanceTiers", "Disabled", "Stopping", "Stopped", and "Starting". |
|
database_id
|
The ID of the database. |
|
creation_date
|
The creation date of the database (ISO8601 format). |
|
current_service_objective_name
|
The current service level objective name of the database. |
|
requested_service_objective_name
|
The requested service level objective name of the database. |
|
default_secondary_location
|
The default secondary region for this database. |
|
failover_group_id
|
Failover Group resource identifier that this database belongs to. |
|
restore_point_in_time
|
Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. |
|
source_database_deletion_date
|
Specifies the time that the database was deleted. |
|
recovery_services_recovery_point_id
|
The resource identifier of the recovery point associated with create operation of this database. |
|
long_term_retention_backup_resource_id
|
The resource identifier of the long term retention backup associated with create operation of this database. |
|
recoverable_database_id
|
The resource identifier of the recoverable database associated with create operation of this database. |
|
restorable_dropped_database_id
|
The resource identifier of the restorable dropped database associated with create operation of this database. |
|
catalog_collation
|
Collation of the metadata catalog. Known values are: "DATABASE_DEFAULT" and "SQL_Latin1_General_CP1_CI_AS". |
|
zone_redundant
|
Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. |
|
license_type
|
The license type to apply for this database. |
|
max_log_size_bytes
|
The max log size for this database. |
|
earliest_restore_date
|
This records the earliest start date and time that restore is available for this database (ISO8601 format). |
|
read_scale
|
The state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Not applicable to a Hyperscale database within an elastic pool. Known values are: "Enabled" and "Disabled". |
|
high_availability_replica_count
|
The number of secondary replicas associated with the database that are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. |
|
secondary_type
|
str or
SecondaryType
The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby. Known values are: "Geo", "Named", and "Standby". |
|
current_sku
|
The name and tier of the SKU. |
|
auto_pause_delay
|
Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. |
|
current_backup_storage_redundancy
|
The storage account type used to store backups for this database. Known values are: "Geo", "Local", "Zone", and "GeoZone". |
|
requested_backup_storage_redundancy
|
The storage account type to be used to store backups for this database. Known values are: "Geo", "Local", "Zone", and "GeoZone". |
|
min_capacity
|
Minimal capacity that database will always have allocated, if not paused. |
|
paused_date
|
The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. |
|
resumed_date
|
The date when database was resumed by user action or database login (ISO8601 format). Null if the database is paused. |
|
maintenance_configuration_id
|
Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates will occur. |
|
is_ledger_on
|
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. |
|
is_infra_encryption_enabled
|
Infra encryption is enabled for this database. |
|
federated_client_id
|
The Client id used for cross tenant per database CMK scenario. |
|
keys
|
The resource ids of the user assigned identities to use. |
|
encryption_protector
|
The azure key vault URI of the database if it's configured with per Database Customer Managed Keys. |
|
preferred_enclave_type
|
Type of enclave requested on the database i.e. Default or VBS enclaves. Known values are: "Default" and "VBS". |
|
use_free_limit
|
Whether or not the database uses free monthly limits. Allowed on one database in a subscription. |
|
free_limit_exhaustion_behavior
|
Specifies the behavior when monthly free limits are exhausted for the free database. AutoPause: The database will be auto paused upon exhaustion of free limits for remainder of the month. BillForUsage: The database will continue to be online upon exhaustion of free limits and any overage will be billed. Known values are: "AutoPause" and "BillOverUsage". |
|
source_resource_id
|
The resource identifier of the source associated with the create operation of this database. This property is only supported for DataWarehouse edition and allows to restore across subscriptions. When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or existing sql pool, and restorePointInTime must be specified. When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped sql pool. When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool. When source subscription belongs to a different tenant than target subscription, "x-ms-authorization-auxiliary" header must contain authentication token for the source tenant. For more details about "x-ms-authorization-auxiliary" header see https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. |
|
manual_cutover
|
Whether or not customer controlled manual cutover needs to be done during Update Database operation to Hyperscale tier. This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to Hyperscale tier. When manualCutover is specified, the scaling operation will wait for user input to trigger cutover to Hyperscale database. To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in Waiting state. |
|
perform_cutover
|
To trigger customer controlled manual cutover during the wait state while Scaling operation is in progress. This property parameter is only applicable for scaling operations that are initiated along with 'manualCutover' parameter. This property is only applicable when scaling database from Business Critical/General Purpose/Premium/Standard tier to Hyperscale tier is already in progress. When performCutover is specified, the scaling operation will trigger cutover and perform role-change to Hyperscale database. |
|
availability_zone
|
Specifies the availability zone the database is pinned to. Known values are: "NoPreference", "1", "2", and "3". |
|
encryption_protector_auto_rotation
|
The flag to enable or disable auto rotation of database encryption protector AKV key. |