Share via


az sql vm

Manage SQL virtual machines.

Commands

Name Description Type Status
az sql vm add-to-group

Adds SQL virtual machine to a SQL virtual machine group.

Core GA
az sql vm create

Creates a SQL virtual machine.

Core GA
az sql vm delete

Deletes a SQL virtual machine.

Core GA
az sql vm enable-azure-ad-auth

Enable Azure AD authentication of a SQL virtual machine.

Core GA
az sql vm group

Manage SQL virtual machine groups.

Core GA
az sql vm group ag-listener

Manage SQL availability group listeners.

Core GA
az sql vm group ag-listener create

Creates an availability group listener.

Core GA
az sql vm group ag-listener delete

Deletes an availability group listener.

Core GA
az sql vm group ag-listener list

Lists all availability group listeners in a SQL virtual machine group.

Core GA
az sql vm group ag-listener show

Gets an availability group listener.

Core GA
az sql vm group ag-listener update

Updates an availability group listener.

Core GA
az sql vm group create

Creates a SQL virtual machine group.

Core GA
az sql vm group delete

Deletes a SQL virtual machine group.

Core GA
az sql vm group list

Lists all SQL virtual machine groups in a resource group or subscription.

Core GA
az sql vm group show

Gets a SQL virtual machine group.

Core GA
az sql vm group update

Updates a SQL virtual machine group if there are not SQL virtual machines attached to the group.

Core GA
az sql vm list

Lists all SQL virtual machines in a resource group or subscription.

Core GA
az sql vm remove-from-group

Remove SQL virtual machine from its current SQL virtual machine group.

Core GA
az sql vm show

Gets a SQL virtual machine.

Core GA
az sql vm start-assessment

Starts SQL best practice assessment on SQL virtual machine.

Core GA
az sql vm update

Updates the properties of a SQL virtual machine.

Core GA
az sql vm validate-azure-ad-auth

Validate Azure AD authentication of a SQL virtual machine at the client side without enabling it.

Core GA

az sql vm add-to-group

Adds SQL virtual machine to a SQL virtual machine group.

az sql vm add-to-group --sqlvm-group
                       [--bootstrap-acc-pwd]
                       [--ids]
                       [--name]
                       [--operator-acc-pwd]
                       [--resource-group]
                       [--service-acc-pwd]
                       [--subscription]

Examples

Add SQL virtual machine to a group.

az sql vm add-to-group -n sqlvm -g myresourcegroup --sqlvm-group sqlvmgroup --bootstrap-acc-pwd {bootstrappassword} --operator-acc-pwd {operatorpassword} --service-acc-pwd {servicepassword}

Required Parameters

--sqlvm-group -r

Name or resource ID of the SQL virtual machine group. If only name provided, SQL virtual machine group should be in the same resource group of the SQL virtual machine.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--bootstrap-acc-pwd -b

Password for the cluster bootstrap account if provided in the SQL virtual machine group.

Property Value
Parameter group: WSFC Domain Credentials Arguments
--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.

Property Value
Parameter group: Resource Id Arguments
--name -n

Name of the SQL virtual machine.

Property Value
Parameter group: Resource Id Arguments
--operator-acc-pwd -p

Password for the cluster operator account provided in the SQL virtual machine group.

Property Value
Parameter group: WSFC Domain Credentials Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--service-acc-pwd -s

Password for the SQL service account provided in the SQL virtual machine group.

Property Value
Parameter group: WSFC Domain Credentials Arguments
--subscription

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

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

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

--verbose

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

Property Value
Default value: False

az sql vm create

Creates a SQL virtual machine.

az sql vm create --name
                 --resource-group
                 [--backup-pwd]
                 [--backup-schedule-type {Automated, Manual}]
                 [--backup-system-dbs {false, true}]
                 [--connectivity-type {LOCAL, PRIVATE, PUBLIC}]
                 [--credential-name]
                 [--day-of-week {Everyday, Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday}]
                 [--enable-auto-backup {false, true}]
                 [--enable-auto-patching {false, true}]
                 [--enable-encryption {false, true}]
                 [--enable-key-vault-credential {false, true}]
                 [--enable-r-services {false, true}]
                 [--full-backup-duration]
                 [--full-backup-frequency {Daily, Weekly}]
                 [--full-backup-start-hour]
                 [--image-offer]
                 [--image-sku {Developer, Enterprise, Express, Standard, Web}]
                 [--key-vault]
                 [--least-privilege-mode {Enabled, NotSet}]
                 [--license-type {AHUB, DR, PAYG}]
                 [--location]
                 [--log-backup-frequency]
                 [--maintenance-window-duration]
                 [--maintenance-window-start-hour]
                 [--port]
                 [--retention-period]
                 [--sa-key]
                 [--sp-name]
                 [--sp-secret]
                 [--sql-auth-update-pwd]
                 [--sql-auth-update-username]
                 [--sql-mgmt-type {Full, LightWeight, NoAgent}]
                 [--sql-workload-type {DW, GENERAL, OLTP}]
                 [--storage-account]
                 [--tags]

Examples

Create a SQL virtual machine with AHUB billing tag.

az sql vm create -n sqlvm -g myresourcegroup -l eastus --license-type AHUB

Create a SQL virtual machine with DR billing tag.

az sql vm create -n sqlvm -g myresourcegroup -l eastus --license-type DR

Create a SQL virtual machine with specific sku type and license type.

az sql vm create -n sqlvm -g myresourcegroup -l eastus --image-sku Enterprise --license-type AHUB

Create a SQL virtual machine with least privilege mode enabled.

az sql vm create -n sqlvm -g myresourcegroup -l eastus --least-privilege-mode Enabled --sql-mgmt-type Full

Create a SQL virtual machine with NoAgent type, only valid for EOS SQL 2008 and SQL 2008 R2.

az sql vm create -n sqlvm -g myresourcegroup -l eastus --license-type AHUB --sql-mgmt-type NoAgent --image-sku Enterprise --image-offer SQL2008-WS2008R2

Enable R services in SQL2016 onwards.

az sql vm create -n sqlvm -g myresourcegroup -l eastus --license-type PAYG --sql-mgmt-type Full --enable-r-services true

Create SQL virtual machine and configure auto backup settings.

az sql vm create -n sqlvm -g myresourcegroup -l eastus --license-type PAYG --sql-mgmt-type Full --backup-schedule-type manual --full-backup-frequency Weekly --full-backup-start-hour 2 --full-backup-duration 2 --sa-key {storageKey} --storage-account 'https://storageacc.blob.core.windows.net/' --retention-period 30 --log-backup-frequency 60

Create SQL virtual machine and configure auto patching settings.

az sql vm create -n sqlvm -g myresourcegroup -l eastus --license-type PAYG --sql-mgmt-type Full --day-of-week sunday --maintenance-window-duration 60 --maintenance-window-start-hour 2

Create SQL virtual machine and configure SQL connectivity settings.

az sql vm create -n sqlvm -g myresourcegroup -l eastus --license-type PAYG --sql-mgmt-type Full --connectivity-type private --port 1433 --sql-auth-update-username {newlogin} --sql-auth-update-pwd {sqlpassword}

Required Parameters

--name -n

Name of the SQL virtual machine. The name of the new SQL virtual machine must be equal to the underlying virtual machine created from SQL marketplace image.

--resource-group -g

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

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--backup-pwd

Password for encryption on backup.

Property Value
Parameter group: Auto Backup Settings Arguments
--backup-schedule-type

Backup schedule type.

Property Value
Parameter group: Auto Backup Settings Arguments
Accepted values: Automated, Manual
--backup-system-dbs

Include system databases on backup.

Property Value
Parameter group: Auto Backup Settings Arguments
Default value: False
Accepted values: false, true
--connectivity-type

SQL Server connectivity option.

Property Value
Parameter group: SQL Connectivity Update Settings Arguments
Accepted values: LOCAL, PRIVATE, PUBLIC
--credential-name

Credential name.

Property Value
Parameter group: Key Vault Credential Settings Arguments
--day-of-week

Day of week to apply the patch on.

Property Value
Parameter group: Auto Patching Settings Arguments
Accepted values: Everyday, Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday
--enable-auto-backup

Enable or disable autobackup on SQL virtual machine. If any backup settings provided, parameter automatically sets to true.

Property Value
Parameter group: Auto Backup Settings Arguments
Accepted values: false, true
--enable-auto-patching

Enable or disable autopatching on SQL virtual machine. If any autopatching settings provided, parameter automatically sets to true.

Property Value
Parameter group: Auto Patching Settings Arguments
Accepted values: false, true
--enable-encryption

Enable encryption for backup on SQL virtual machine.

Property Value
Parameter group: Auto Backup Settings Arguments
Default value: False
Accepted values: false, true
--enable-key-vault-credential

Enable or disable key vault credential setting. If any key vault settings provided, parameter automatically sets to true.

Property Value
Parameter group: Key Vault Credential Settings Arguments
Accepted values: false, true
--enable-r-services

Enable or disable R services (SQL 2016 onwards).

Property Value
Parameter group: Additional Features Arguments
Accepted values: false, true
--full-backup-duration

Duration of the time window of a given day during which full backups can take place. 1-23 hours.

Property Value
Parameter group: Auto Backup Settings Arguments
--full-backup-frequency

Frequency of full backups. In both cases, full backups begin during the next scheduled time window.

Property Value
Parameter group: Auto Backup Settings Arguments
Accepted values: Daily, Weekly
--full-backup-start-hour

Start time of a given day during which full backups can take place. 0-23 hours.

Property Value
Parameter group: Auto Backup Settings Arguments
--image-offer

SQL image offer. Examples include SQL2008R2-WS2008, SQL2008-WS2008.

Property Value
Parameter group: SQL Server License Arguments
--image-sku

SQL image sku.

Property Value
Parameter group: SQL Server License Arguments
Accepted values: Developer, Enterprise, Express, Standard, Web
--key-vault

Azure Key Vault url.

Property Value
Parameter group: Key Vault Credential Settings Arguments
--least-privilege-mode

SQL IaaS Agent Least Privilege Mode. Updates from sysadmin to specific permissions used per feature.

Property Value
Accepted values: Enabled, NotSet
--license-type -i

SQL Server license type.

Property Value
Parameter group: SQL Server License Arguments
Accepted values: AHUB, DR, PAYG
--location -l

Location. If not provided, virtual machine should be in the same region of resource group.You can configure the default location using az configure --defaults location=<location>.

--log-backup-frequency

Frequency of log backups. 5-60 minutes.

Property Value
Parameter group: Auto Backup Settings Arguments
--maintenance-window-duration

Duration of patching. 30-180 minutes.

Property Value
Parameter group: Auto Patching Settings Arguments
--maintenance-window-start-hour

Hour of the day when patching is initiated. Local VM time 0-23 hours.

Property Value
Parameter group: Auto Patching Settings Arguments
--port

SQL Server port.

Property Value
Parameter group: SQL Connectivity Update Settings Arguments
--retention-period

Retention period of backup. 1-30 days.

Property Value
Parameter group: Auto Backup Settings Arguments
--sa-key

Storage account key where backup will be taken to.

Property Value
Parameter group: Auto Backup Settings Arguments
--sp-name

Service principal name to access key vault.

Property Value
Parameter group: Key Vault Credential Settings Arguments
--sp-secret

Service principal name secret to access key vault.

Property Value
Parameter group: Key Vault Credential Settings Arguments
--sql-auth-update-pwd

SQL Server sysadmin login password.

Property Value
Parameter group: SQL Connectivity Update Settings Arguments
--sql-auth-update-username

SQL Server sysadmin login to create.

Property Value
Parameter group: SQL Connectivity Update Settings Arguments
--sql-mgmt-type
Deprecated

Argument 'sql_management_mode' has been deprecated and will be removed in a future release.

SQL Server management type. If NoAgent selected, please provide --image-sku and --offer-type.

Property Value
Default value: LightWeight
Accepted values: Full, LightWeight, NoAgent
--sql-workload-type

SQL Server workload type.

Property Value
Parameter group: SQL Workload Type Update Settings Arguments
Accepted values: DW, GENERAL, OLTP
--storage-account

Storage account url where backup will be taken to.

Property Value
Parameter group: Auto Backup Settings Arguments
--tags

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--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.

Property Value
Default value: False

az sql vm delete

Deletes a SQL virtual machine.

az sql vm delete [--ids]
                 [--name]
                 [--resource-group]
                 [--subscription]
                 [--yes]

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

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

Property Value
Parameter group: Resource Id Arguments
--name -n

Name of the SQL virtual machine.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

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

Property Value
Parameter group: Resource Id Arguments
--yes -y

Do not prompt for confirmation.

Property Value
Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

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

--verbose

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

Property Value
Default value: False

az sql vm enable-azure-ad-auth

Enable Azure AD authentication of a SQL virtual machine.

az sql vm enable-azure-ad-auth [--ids]
                               [--msi-client-id]
                               [--name]
                               [--resource-group]
                               [--skip-client-validation]
                               [--subscription]

Examples

Enable Azure AD authentication with system-assigned managed identity with client side validation.

az sql vm enable-azure-ad-auth -n sqlvm -g myresourcegroup

Enable Azure AD authentication with user-assigned managed identity with client side validation.

az sql vm enable-azure-ad-auth -n sqlvm -g myresourcegroup --msi-client-id 12345678

Enable Azure AD authentication with system-assigned managed identity skipping client side validation. The server side validation always happens.

az sql vm enable-azure-ad-auth -n sqlvm -g myresourcegroup --skip-client-validation

Enable Azure AD authentication with user-assigned managed identity skipping client side validation. The server side validation always happens.

az sql vm enable-azure-ad-auth -n sqlvm -g myresourcegroup --msi-client-id 12345678 --skip-client-validation

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

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

Property Value
Parameter group: Resource Id Arguments
--msi-client-id

Virutal Machine Managed Identity Client ID.

--name -n

Name of the SQL virtual machine.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--skip-client-validation

Skip client side Azure AD authentication validation, the server side validation will still happen.

--subscription

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

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

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

--verbose

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

Property Value
Default value: False

az sql vm list

Lists all SQL virtual machines in a resource group or subscription.

az sql vm list [--resource-group]

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--resource-group -g

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--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.

Property Value
Default value: False

az sql vm remove-from-group

Remove SQL virtual machine from its current SQL virtual machine group.

az sql vm remove-from-group [--ids]
                            [--name]
                            [--resource-group]
                            [--subscription]

Examples

Remove SQL virtual machine from a group.

az sql vm remove-from-group -n sqlvm -g myresourcegroup

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

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

Property Value
Parameter group: Resource Id Arguments
--name -n

Name of the SQL virtual machine.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

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

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

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

--verbose

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

Property Value
Default value: False

az sql vm show

Gets a SQL virtual machine.

az sql vm show [--expand {*, AssessmentSettings, AutoBackupSettings, AutoPatchingSettings, KeyVaultCredentialSettings, ServerConfigurationsManagementSettings}]
               [--ids]
               [--name]
               [--resource-group]
               [--subscription]

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--expand

Get the SQLIaaSExtension configuration settings. To view all settings, use *. To select only a few, the settings must be space-separated.

Property Value
Accepted values: *, AssessmentSettings, AutoBackupSettings, AutoPatchingSettings, KeyVaultCredentialSettings, ServerConfigurationsManagementSettings
--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.

Property Value
Parameter group: Resource Id Arguments
--name -n

Name of the SQL virtual machine.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

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

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

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

--verbose

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

Property Value
Default value: False

az sql vm start-assessment

Starts SQL best practice assessment on SQL virtual machine.

az sql vm start-assessment [--ids]
                           [--name]
                           [--resource-group]
                           [--subscription]

Examples

Starts SQL best practice assessment.

az sql vm start-assessment -n sqlvm -g myresourcegroup

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

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

Property Value
Parameter group: Resource Id Arguments
--name -n

Name of the SQL virtual machine.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

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

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

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

--verbose

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

Property Value
Default value: False

az sql vm update

Updates the properties of a SQL virtual machine.

az sql vm update [--add]
                 [--agent-rg]
                 [--am-day --assessment-day-of-week {Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday}]
                 [--am-month-occ --assessment-monthly-occurrence {-1, 1, 2, 3, 4}]
                 [--am-schedule --enable-assessment-schedule {false, true}]
                 [--am-time --assessment-start-time-local]
                 [--am-week-int --assessment-weekly-interval {1, 2, 3, 4, 5, 6}]
                 [--backup-pwd]
                 [--backup-schedule-type {Automated, Manual}]
                 [--backup-system-dbs {false, true}]
                 [--connectivity-type {LOCAL, PRIVATE, PUBLIC}]
                 [--credential-name]
                 [--day-of-week {Everyday, Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday}]
                 [--enable-assessment {false, true}]
                 [--enable-auto-backup {false, true}]
                 [--enable-auto-patching {false, true}]
                 [--enable-encryption {false, true}]
                 [--enable-key-vault-credential {false, true}]
                 [--enable-r-services {false, true}]
                 [--force-string]
                 [--full-backup-duration]
                 [--full-backup-frequency {Daily, Weekly}]
                 [--full-backup-start-hour]
                 [--ids]
                 [--image-sku {Developer, Enterprise, Express, Standard, Web}]
                 [--key-vault]
                 [--least-privilege-mode {Enabled, NotSet}]
                 [--license-type {AHUB, DR, PAYG}]
                 [--log-backup-frequency]
                 [--maintenance-window-duration]
                 [--maintenance-window-start-hour]
                 [--name]
                 [--port]
                 [--remove]
                 [--resource-group]
                 [--retention-period]
                 [--sa-key]
                 [--set]
                 [--sp-name]
                 [--sp-secret]
                 [--sql-mgmt-type {Full, LightWeight, NoAgent}]
                 [--sql-workload-type {DW, GENERAL, OLTP}]
                 [--storage-account]
                 [--subscription]
                 [--tags]
                 [--workspace-name]
                 [--workspace-rg]
                 [--workspace-sub]
                 [--yes]

Examples

Add or update a tag.

az sql vm update -n sqlvm -g myresourcegroup --set tags.tagName=tagValue

Remove a tag.

az sql vm update -n sqlvm -g myresourcegroup --remove tags.tagName

Update a SQL virtual machine with specific sku type.

az sql vm update -n sqlvm -g myresourcegroup --image-sku Enterprise

Update a SQL virtual machine manageability from LightWeight to Full.

az sql vm update -n sqlvm -g myresourcegroup --sql-mgmt-type Full

Update a SQL virtual machine to least privilege mode.

az sql vm update -n sqlvm -g myresourcegroup --least-privilege-mode Enabled --sql-mgmt-type Full

Update SQL virtual machine auto backup settings.

az sql vm update -n sqlvm -g myresourcegroup --backup-schedule-type manual --full-backup-frequency Weekly --full-backup-start-hour 2 --full-backup-duration 2 --sa-key {storageKey} --storage-account 'https://storageacc.blob.core.windows.net/' --retention-period 30 --log-backup-frequency 60

Disable SQL virtual machine auto backup settings.

az sql vm update -n sqlvm -g myresourcegroup --enable-auto-backup false

Update SQL virtual machine auto patching settings.

az sql vm update -n sqlvm -g myresourcegroup --day-of-week sunday --maintenance-window-duration 60 --maintenance-window-start-hour 2

Disable SQL virtual machine auto patching settings.

az sql vm update -n sqlvm -g myresourcegroup --enable-auto-patching false

Update a SQL virtual machine billing tag to AHUB.

az sql vm update -n sqlvm -g myresourcegroup --license-type AHUB

Update a SQL virtual machine billing tag to DR.

az sql vm update -n sqlvm -g myresourcegroup --license-type DR

Update a SQL virtual machine to disable SQL best practice assessment.

az sql vm update -n sqlvm -g myresourcegroup --enable-assessment false

Update a SQL virtual machine to disable schedule for SQL best practice assessment.

az sql vm update -n sqlvm -g myresourcegroup --enable-assessment-schedule false

Update a SQL virtual machine to enable schedule with weekly interval for SQL best practice assessment when VM is already associated with a Log Analytics workspace.

az sql vm update -n sqlvm -g myresourcegroup --assessment-weekly-interval 1 --assessment-day-of-week monday --assessment-start-time-local '19:30'

Update a SQL virtual machine to enable schedule with monthly occurrence for SQL best practice assessment while associating with a Log Analytics workspace and assigning a Resource group for the Agent resources.

az sql vm update -n sqlvm -g myresourcegroup --workspace-name myLogAnalyticsWorkspace --workspace-rg myRg --agent-rg myRg2 --assessment-monthly-occurrence 1 --assessment-day-of-week monday --assessment-start-time-local '19:30'

Update a SQL virtual machine to enable SQL best practices assessment without setting a schedule for running assessment on-demand. Must provide Log Analytics workspace and a Resource group for deploying the Agent resources.

az sql vm update -n sqlvm -g myresourcegroup --enable-assessment true --workspace-name myLogAnalyticsWorkspace --workspace-rg myRg --agent-rg myRg2

Update a SQL virtual machine to enable SQL best practices assessment while associating with a Log Analytics Workspace in a different subscription

az sql vm update -n sqlvm -g myresourcegroup --enable-assessment true --workspace-name myLogAnalyticsWorkspace --workspace-rg myRg --workspace-sub myLogAnalyticsWorkspaceSubName --agent-rg myRg2

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

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

Property Value
Parameter group: Generic Update Arguments
Default value: []
--agent-rg

Resource group containing the AMA resources DCE and DCR.

Property Value
Parameter group: Assessment Settings Arguments
--am-day --assessment-day-of-week

Day of the week to run assessment.

Property Value
Parameter group: Assessment Settings Arguments
Accepted values: Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday
--am-month-occ --assessment-monthly-occurrence

Occurrence of the DayOfWeek day within a month to schedule assessment. Supports values 1,2,3,4 and -1. Use -1 for last DayOfWeek day of the month (for example - last Tuesday of the month).

Property Value
Parameter group: Assessment Settings Arguments
Accepted values: -1, 1, 2, 3, 4
--am-schedule --enable-assessment-schedule

Enable or disable assessment Schedule. If any assessment schedule settings provided, parameter automatically sets to true.

Property Value
Parameter group: Assessment Settings Arguments
Accepted values: false, true
--am-time --assessment-start-time-local

Time of the day in HH:mm format. Examples include 17:30, 05:13.

Property Value
Parameter group: Assessment Settings Arguments
--am-week-int --assessment-weekly-interval

Number of weeks to schedule between 2 assessment runs. Supports value from 1-6.

Property Value
Parameter group: Assessment Settings Arguments
Accepted values: 1, 2, 3, 4, 5, 6
--backup-pwd

Password for encryption on backup.

Property Value
Parameter group: Auto Backup Settings Arguments
--backup-schedule-type

Backup schedule type.

Property Value
Parameter group: Auto Backup Settings Arguments
Accepted values: Automated, Manual
--backup-system-dbs

Include system databases on backup.

Property Value
Parameter group: Auto Backup Settings Arguments
Default value: False
Accepted values: false, true
--connectivity-type

SQL Server connectivity option.

Property Value
Parameter group: SQL Connectivity Update Settings Arguments
Accepted values: LOCAL, PRIVATE, PUBLIC
--credential-name

Credential name.

Property Value
Parameter group: Key Vault Credential Settings Arguments
--day-of-week

Day of week to apply the patch on.

Property Value
Parameter group: Auto Patching Settings Arguments
Accepted values: Everyday, Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday
--enable-assessment

Enable or disable assessment feature. If any assessment settings provided, parameter automatically sets to true.

Property Value
Parameter group: Assessment Settings Arguments
Accepted values: false, true
--enable-auto-backup

Enable or disable autobackup on SQL virtual machine. If any backup settings provided, parameter automatically sets to true.

Property Value
Parameter group: Auto Backup Settings Arguments
Accepted values: false, true
--enable-auto-patching

Enable or disable autopatching on SQL virtual machine. If any autopatching settings provided, parameter automatically sets to true.

Property Value
Parameter group: Auto Patching Settings Arguments
Accepted values: false, true
--enable-encryption

Enable encryption for backup on SQL virtual machine.

Property Value
Parameter group: Auto Backup Settings Arguments
Default value: False
Accepted values: false, true
--enable-key-vault-credential

Enable or disable key vault credential setting. If any key vault settings provided, parameter automatically sets to true.

Property Value
Parameter group: Key Vault Credential Settings Arguments
Accepted values: false, true
--enable-r-services

Enable or disable R services (SQL 2016 onwards).

Property Value
Parameter group: Additional Features Arguments
Accepted values: false, true
--force-string

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

Property Value
Parameter group: Generic Update Arguments
Default value: False
--full-backup-duration

Duration of the time window of a given day during which full backups can take place. 1-23 hours.

Property Value
Parameter group: Auto Backup Settings Arguments
--full-backup-frequency

Frequency of full backups. In both cases, full backups begin during the next scheduled time window.

Property Value
Parameter group: Auto Backup Settings Arguments
Accepted values: Daily, Weekly
--full-backup-start-hour

Start time of a given day during which full backups can take place. 0-23 hours.

Property Value
Parameter group: Auto Backup Settings Arguments
--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.

Property Value
Parameter group: Resource Id Arguments
--image-sku

SQL image sku.

Property Value
Parameter group: SQL Server License Arguments
Accepted values: Developer, Enterprise, Express, Standard, Web
--key-vault

Azure Key Vault url.

Property Value
Parameter group: Key Vault Credential Settings Arguments
--least-privilege-mode

SQL IaaS Agent Least Privilege Mode. Updates from sysadmin to specific permissions used per feature.

Property Value
Accepted values: Enabled, NotSet
--license-type -i

SQL Server license type.

Property Value
Parameter group: SQL Server License Arguments
Accepted values: AHUB, DR, PAYG
--log-backup-frequency

Frequency of log backups. 5-60 minutes.

Property Value
Parameter group: Auto Backup Settings Arguments
--maintenance-window-duration

Duration of patching. 30-180 minutes.

Property Value
Parameter group: Auto Patching Settings Arguments
--maintenance-window-start-hour

Hour of the day when patching is initiated. Local VM time 0-23 hours.

Property Value
Parameter group: Auto Patching Settings Arguments
--name -n

Name of the SQL virtual machine.

Property Value
Parameter group: Resource Id Arguments
--port

SQL Server port.

Property Value
Parameter group: SQL Connectivity Update Settings Arguments
--remove

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

Property Value
Parameter group: Generic Update Arguments
Default value: []
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--retention-period

Retention period of backup. 1-30 days.

Property Value
Parameter group: Auto Backup Settings Arguments
--sa-key

Storage account key where backup will be taken to.

Property Value
Parameter group: Auto Backup Settings Arguments
--set

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

Property Value
Parameter group: Generic Update Arguments
Default value: []
--sp-name

Service principal name to access key vault.

Property Value
Parameter group: Key Vault Credential Settings Arguments
--sp-secret

Service principal name secret to access key vault.

Property Value
Parameter group: Key Vault Credential Settings Arguments
--sql-mgmt-type
Deprecated

Argument 'sql_management_mode' has been deprecated and will be removed in a future release.

SQL Server management type. Updates from LightWeight to Full.

Property Value
Accepted values: Full, LightWeight, NoAgent
--sql-workload-type

SQL Server workload type.

Property Value
Parameter group: SQL Workload Type Update Settings Arguments
Accepted values: DW, GENERAL, OLTP
--storage-account

Storage account url where backup will be taken to.

Property Value
Parameter group: Auto Backup Settings Arguments
--subscription

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

Property Value
Parameter group: Resource Id Arguments
--tags

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

--workspace-name

Name of the Log Analytics workspace to associate with VM.

Property Value
Parameter group: Assessment Settings Arguments
--workspace-rg

Resource group containing the Log Analytics workspace.

Property Value
Parameter group: Assessment Settings Arguments
--workspace-sub

Subscription containing the Log Analytics workspace.

Property Value
Parameter group: Assessment Settings Arguments
--yes -y
Deprecated

Argument 'prompt' has been deprecated and will be removed in a future release.

Do not prompt for confirmation. Requires --sql-mgmt-type.

Property Value
Default value: True
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

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

--verbose

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

Property Value
Default value: False

az sql vm validate-azure-ad-auth

Validate Azure AD authentication of a SQL virtual machine at the client side without enabling it.

az sql vm validate-azure-ad-auth [--ids]
                                 [--msi-client-id]
                                 [--name]
                                 [--resource-group]
                                 [--subscription]

Examples

Validate Azure AD authentication with system-assigned managed identity at the client side.

az sql vm validate-azure-ad-auth -n sqlvm -g myresourcegroup

Validate Azure AD authentication with user-assigned managed identity at the client side.

az sql vm validate-azure-ad-auth -n sqlvm -g myresourcegroup --msi-client-id 12345678

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

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

Property Value
Parameter group: Resource Id Arguments
--msi-client-id

Virutal Machine Managed Identity Client ID.

--name -n

Name of the SQL virtual machine.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

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

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

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

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

--verbose

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

Property Value
Default value: False