az sql midb

Manage SQL managed instance databases.

Commands

az sql midb create

Create a managed database.

az sql midb delete

Delete a managed database.

az sql midb list

List managed databases on a managed instance.

az sql midb list-deleted

List restorable deleted managed databases.

az sql midb ltr-backup

Manage SQL Managed Instance database long term retention backups.

az sql midb ltr-backup delete

Delete a long term retention backup.

az sql midb ltr-backup list

List the long term retention backups for a location, instance or database.

az sql midb ltr-backup restore

Restore a long term retention backup to a new database.

az sql midb ltr-backup show

Get a long term retention backup for a managed database.

az sql midb ltr-backup wait

Place the CLI in a waiting state until a condition of the managed database is met.

az sql midb ltr-policy

Manage SQL Managed Instance database long term retention policy.

az sql midb ltr-policy set

Update long term retention settings for a managed database.

az sql midb ltr-policy show

Show the long term retention policy for a managed database.

az sql midb restore

Restore a managed database.

az sql midb short-term-retention-policy

Manage SQL Managed Instance database backup short term retention policy.

az sql midb short-term-retention-policy set

Update short term retention for automated backups on a single database.

az sql midb short-term-retention-policy show

Show short term retention for automated backups on a single database.

az sql midb show

Get the details for a managed database.

az sql midb create

Create a managed database.

az sql midb create --managed-instance
                   --name
                   --resource-group
                   [--collation]
                   [--no-wait]
                   [--subscription]

Examples

Create a managed database with specified collation

az sql midb create -g mygroup --mi myinstance -n mymanageddb --collation Latin1_General_100_CS_AS_SC

Required Parameters

--managed-instance --mi

Name of the Azure SQL managed instance.

--name -n

The name of the Azure SQL Managed Database.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--collation

The collation of the Azure SQL Managed Database collation to use, e.g.: SQL_Latin1_General_CP1_CI_AS or Latin1_General_100_CS_AS_SC.

--no-wait

Do not wait for the long-running operation to finish.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az sql midb delete

Delete a managed database.

az sql midb delete [--ids]
                   [--managed-instance]
                   [--name]
                   [--no-wait]
                   [--resource-group]
                   [--subscription]
                   [--yes]

Examples

Delete a managed database

az sql midb delete -g mygroup --mi myinstance -n mymanageddb --yes

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--managed-instance --mi

Name of the Azure SQL managed instance.

--name -n

The name of the Azure SQL Managed Database.

--no-wait

Do not wait for the long-running operation to finish.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for confirmation.

az sql midb list

List managed databases on a managed instance.

az sql midb list [--ids]
                 [--managed-instance]
                 [--query-examples]
                 [--resource-group]
                 [--subscription]

Examples

List managed databases on a managed instance

az sql midb list -g mygroup --mi myinstance

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--managed-instance --mi

Name of the Azure SQL managed instance.

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az sql midb list-deleted

List restorable deleted managed databases.

az sql midb list-deleted [--ids]
                         [--managed-instance]
                         [--resource-group]
                         [--subscription]

Examples

List all restorable deleted managed databases on Managed Instance .

az sql midb list-deleted -g mygroup --mi myinstance

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--managed-instance --mi

Name of the Azure SQL managed instance.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az sql midb restore

Restore a managed database.

az sql midb restore --dest-name
                    --time
                    [--deleted-time]
                    [--dest-mi]
                    [--dest-resource-group]
                    [--ids]
                    [--managed-instance]
                    [--name]
                    [--no-wait]
                    [--resource-group]
                    [--subscription]

Examples

Restore a live managed database using Point in time restore

az sql midb restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22"

Restore a dropped managed database using Point in time restore

az sql midb restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" --deleted-time "2018-05-20T05:34:22"

Restore a live managed database from another instance using Point in time restore

az sql midb restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" --dest-mi targetmi --dest-resource-group targetrg

Required Parameters

--dest-name

Name of the managed database that will be created as the restore destination.

--time -t

The point in time of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. Time should be in following format: "YYYY-MM-DDTHH:MM:SS".

Optional Parameters

--deleted-time

If specified, restore from a deleted database instead of from an existing database. Must match the deleted time of a deleted database on the source Managed Instance.

--dest-mi

Name of the managed instance to restore managed database to. This can be same managed instance, or another managed instance on same subscription. When not specified it defaults to source managed instance.

--dest-resource-group

Name of the resource group of the managed instance to restore managed database to. When not specified it defaults to source resource group.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--managed-instance --mi

Name of the Azure SQL managed instance.

--name -n

The name of the Azure SQL Managed Database.

--no-wait

Do not wait for the long-running operation to finish.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az sql midb show

Get the details for a managed database.

az sql midb show [--ids]
                 [--managed-instance]
                 [--name]
                 [--query-examples]
                 [--resource-group]
                 [--subscription]

Examples

Get the details for a managed database

az sql midb show -g mygroup --mi myinstance -n mymanageddb

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--managed-instance --mi

Name of the Azure SQL managed instance.

--name -n

The name of the Azure SQL Managed Database.

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.