Share via


az sql midb

Manage SQL Managed Instance databases.

Commands

Name Description Type Status
az sql midb advanced-threat-protection-setting

Manage a SQL Managed Instance database's advanced threat protection setting.

Core GA
az sql midb advanced-threat-protection-setting show

Gets an advanced threat protection setting.

Core GA
az sql midb advanced-threat-protection-setting update

Update a SQL Managed Instance database's advanced threat protection setting.

Core GA
az sql midb copy

Start, complete, cancel and list managed database copy operations.

Core GA
az sql midb copy cancel

Cancel managed database copy operation.

Core GA
az sql midb copy complete

Complete managed database copy operation.

Core GA
az sql midb copy list

List managed database copy operations.

Core GA
az sql midb copy start

Start managed database copy operation.

Core GA
az sql midb create

Create a managed database.

Core GA
az sql midb delete

Delete a managed database.

Core GA
az sql midb ledger-digest-uploads

Manage ledger digest upload settings.

Core GA
az sql midb ledger-digest-uploads disable

Disable uploading ledger digests.

Core GA
az sql midb ledger-digest-uploads enable

Enable uploading ledger digests to an Azure Storage account or to Azure Confidential Ledger. If uploading ledger digests is already enabled, the cmdlet resets the digest storage endpoint to a new value.

Core GA
az sql midb ledger-digest-uploads show

Show the current ledger digest settings.

Core GA
az sql midb list

List managed databases on a managed instance.

Core GA
az sql midb list-deleted

List restorable deleted managed databases.

Core GA
az sql midb log-replay

SQL Managed Instance database Log Replay service commands.

Core GA
az sql midb log-replay complete

Complete Log Replay service on specified database.

Core GA
az sql midb log-replay show

Get status of Log Replay service.

Core GA
az sql midb log-replay start

Start Log Replay service on specified database.

Core GA
az sql midb log-replay stop

Stop Log Replay service.

Core GA
az sql midb log-replay wait

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

Core GA
az sql midb ltr-backup

Manage SQL Managed Instance database long term retention backups.

Core GA
az sql midb ltr-backup delete

Delete a long term retention backup.

Core Preview
az sql midb ltr-backup list

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

Core Preview
az sql midb ltr-backup restore

Restore a long term retention backup to a new database.

Core Preview
az sql midb ltr-backup show

Get a long term retention backup for a managed database.

Core Preview
az sql midb ltr-backup wait

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

Core GA
az sql midb ltr-policy

Manage SQL Managed Instance database long term retention policy.

Core GA
az sql midb ltr-policy set

Update long term retention settings for a managed database.

Core Preview
az sql midb ltr-policy show

Show the long term retention policy for a managed database.

Core Preview
az sql midb move

Start, complete, cancel and list managed database move operations.

Core GA
az sql midb move cancel

Cancel managed database move operation.

Core GA
az sql midb move complete

Complete managed database move operation.

Core GA
az sql midb move list

List managed database move operations.

Core GA
az sql midb move start

Start managed database move operation.

Core GA
az sql midb recover

Recover a managed database using geo-pair instance backup.

Core GA
az sql midb restore

Restore a managed database.

Core GA
az sql midb short-term-retention-policy

Manage SQL Managed Instance database backup short term retention policy.

Core GA
az sql midb short-term-retention-policy set

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

Core Preview
az sql midb short-term-retention-policy show

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

Core Preview
az sql midb show

Get the details for a managed database.

Core GA
az sql midb update

Update a managed database.

Core GA

az sql midb create

Create a managed database.

az sql midb create --managed-instance
                   --name
                   --resource-group
                   [--collation]
                   [--ledger-on {Disabled, Enabled}]
                   [--no-wait]
                   [--tags]

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.

--ledger-on

Create a ledger database, in which the integrity of all data is protected by the ledger feature. All tables in the ledger database must be ledger tables. Note: the value of this property cannot be changed after the database has been created.

Accepted values: Disabled, Enabled
--no-wait

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

Default value: False
--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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.

Default value: False
--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.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az sql midb list

List managed databases on a managed instance.

az sql midb list [--ids]
                 [--managed-instance]
                 [--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.

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az sql midb recover

Recover a managed database using geo-pair instance backup.

az sql midb recover --recoverable-database-id
                    [--ids]
                    [--managed-instance]
                    [--name]
                    [--no-wait]
                    [--resource-group]
                    [--subscription]

Examples

Recover managed database using recoverable database id

az sql midb recover -g mygroup --mi myinstance -n mymanageddb -r '/subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Sql/managedInstances/myinstance/recoverableDatabases/db1'

Required Parameters

--recoverable-database-id -r

The id of recoverable database from geo-replicated instance.

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.

Default value: False
--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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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]
                    [--source-sub]
                    [--subscription]
                    [--tags]

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

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

az sql midb restore -s sourcesubscriptionid -g sourcegroup --mi sourceinstance -n sourcemanageddb --dest-name targetmidb --dest-mi targetmi --time "2018-05-20T05:34:22"

Restore a dropped managed database from another subscription using Point in time restore

az sql midb restore -s sourcesubscriptionid -g sourcegroup --mi sourceinstance -n sourcemanageddb --dest-name targetmidb --dest-mi targetmi --time "2018-05-20T05:34:22" --deleted-time "2018-05-20T05:34:22"

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.

Default value: False
--resource-group -g

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

--source-sub -s

Subscription id of the source database, the one restored from. This parameter should be used when doing cross subscription restore.

--subscription

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

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az sql midb show

Get the details for a managed database.

az sql midb show [--ids]
                 [--managed-instance]
                 [--name]
                 [--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.

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az sql midb update

Update a managed database.

az sql midb update [--add]
                   [--force-string]
                   [--ids]
                   [--managed-instance]
                   [--name]
                   [--no-wait]
                   [--remove]
                   [--resource-group]
                   [--set]
                   [--subscription]
                   [--tags]

Examples

Update a managed database with specified tags

az sql midb update -g mygroup --mi myinstance -n mymanageddb --tags tag1="value1"

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

Default value: []
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

Default value: False
--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.

Default value: False
--remove

Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove.

Default value: []
--resource-group -g

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

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>.

Default value: []
--subscription

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

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.