Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Update-AzSqlVM

Updates a SQL virtual machine.

Syntax

UpdateExpanded (Default)

Update-AzSqlVM
 -Name <String>
 -ResourceGroupName <String>
 [-SubscriptionId <String>]
 [-LicenseType <String>]
 [-Offer <String>]
 [-Sku <String>]
 [-SqlManagementType <String>]
 [-Tag <Hashtable>]
 [-AutoBackupSettingBackupScheduleType <String>]
 [-AutoBackupSettingBackupSystemDb]
 [-AutoBackupSettingDaysOfWeek <String[]>]
 [-AutoBackupSettingEnable]
 [-AutoBackupSettingEnableEncryption]
 [-AutoBackupSettingFullBackupFrequency <String>]
 [-AutoBackupSettingFullBackupStartTime <Int32>]
 [-AutoBackupSettingFullBackupWindowHour <Int32>]
 [-AutoBackupSettingLogBackupFrequency <Int32>]
 [-AutoBackupSettingPassword <SecureString>]
 [-AutoBackupSettingRetentionPeriod <Int32>]
 [-AutoBackupSettingStorageAccessKey <String>]
 [-AutoBackupSettingStorageAccountUrl <String>]
 [-AutoBackupSettingStorageContainerName <String>]
 [-AutoPatchingSettingDayOfWeek <String>]
 [-AutoPatchingSettingEnable]
 [-AutoPatchingSettingMaintenanceWindowDuration <Int32>]
 [-AutoPatchingSettingMaintenanceWindowStartingHour <Int32>]
 [-AssessmentSettingEnable]
 [-AssessmentSettingRunImmediately]
 [-ScheduleDayOfWeek <String>]
 [-ScheduleEnable]
 [-ScheduleMonthlyOccurrence <Int32>]
 [-ScheduleStartTime <String>]
 [-ScheduleWeeklyInterval <Int32>]
 [-SqlVirtualMachineGroupResourceId <String>]
 [-VirtualMachineResourceId <String>]
 [-WsfcDomainCredentialsClusterBootstrapAccountPassword <SecureString>]
 [-WsfcDomainCredentialsClusterOperatorAccountPassword <SecureString>]
 [-WsfcDomainCredentialsSqlServiceAccountPassword <SecureString>]
 [-WsfcStaticIP <String>]
 [-EnableAutomaticUpgrade]
 [-ManagedIdentityClientId <String>]
 [-IdentityType <String>]
 [-DefaultProfile <PSObject>]
 [-AsJob]
 [-NoWait]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

UpdateViaIdentity

Update-AzSqlVM
 -InputObject <ISqlVirtualMachineIdentity>
 [-LicenseType <String>]
 [-Offer <String>]
 [-Sku <String>]
 [-SqlManagementType <String>]
 [-Tag <Hashtable>]
 [-AutoBackupSettingBackupScheduleType <String>]
 [-AutoBackupSettingBackupSystemDb]
 [-AutoBackupSettingDaysOfWeek <String[]>]
 [-AutoBackupSettingEnable]
 [-AutoBackupSettingEnableEncryption]
 [-AutoBackupSettingFullBackupFrequency <String>]
 [-AutoBackupSettingFullBackupStartTime <Int32>]
 [-AutoBackupSettingFullBackupWindowHour <Int32>]
 [-AutoBackupSettingLogBackupFrequency <Int32>]
 [-AutoBackupSettingPassword <SecureString>]
 [-AutoBackupSettingRetentionPeriod <Int32>]
 [-AutoBackupSettingStorageAccessKey <String>]
 [-AutoBackupSettingStorageAccountUrl <String>]
 [-AutoBackupSettingStorageContainerName <String>]
 [-AutoPatchingSettingDayOfWeek <String>]
 [-AutoPatchingSettingEnable]
 [-AutoPatchingSettingMaintenanceWindowDuration <Int32>]
 [-AutoPatchingSettingMaintenanceWindowStartingHour <Int32>]
 [-AssessmentSettingEnable]
 [-AssessmentSettingRunImmediately]
 [-ScheduleDayOfWeek <String>]
 [-ScheduleEnable]
 [-ScheduleMonthlyOccurrence <Int32>]
 [-ScheduleStartTime <String>]
 [-ScheduleWeeklyInterval <Int32>]
 [-SqlVirtualMachineGroupResourceId <String>]
 [-VirtualMachineResourceId <String>]
 [-WsfcDomainCredentialsClusterBootstrapAccountPassword <SecureString>]
 [-WsfcDomainCredentialsClusterOperatorAccountPassword <SecureString>]
 [-WsfcDomainCredentialsSqlServiceAccountPassword <SecureString>]
 [-WsfcStaticIP <String>]
 [-EnableAutomaticUpgrade]
 [-ManagedIdentityClientId <String>]
 [-IdentityType <String>]
 [-DefaultProfile <PSObject>]
 [-AsJob]
 [-NoWait]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

Description

Updates a SQL virtual machine.

Examples

Example 1

Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -LicenseType 'AHUB' -Tag @{'newkey'='newvalue'}
Location	Name		ResourceGroupName
--------	----		-----------------
eastus		sqlvm1		ResourceGroup01

Update a SQL virtual machine with AHUB billing and add a tag.

Example 2

$sqlVM = Get-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1'
$sqlVM | Update-AzSqlVM -Sku 'Standard' -LicenseType 'AHUB'
Location	Name		ResourceGroupName
--------	----		-----------------
eastus		sqlvm1		ResourceGroup01

Update a SQL virtual machine's sku and license type via identity.

Example 3

Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -AutoBackupSettingEnable `
-AutoBackupSettingBackupScheduleType manual -AutoBackupSettingFullBackupFrequency Weekly -AutoBackupSettingFullBackupStartTime 5 `
-AutoBackupSettingFullBackupWindowHour 2 -AutoBackupSettingStorageAccessKey 'keyvalue' -AutoBackupSettingStorageAccountUrl `
'https://storagename.blob.core.windows.net/' -AutoBackupSettingRetentionPeriod 10 -AutoBackupSettingLogBackupFrequency 60 `
-AutoBackupSettingStorageContainerName 'storagecontainername'
Location	Name		ResourceGroupName
--------	----		-----------------
eastus		sqlvm1		ResourceGroup01

Update a SQL virtual machine to enable auto backup.

Example 4

Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -AutoBackupSettingEnable:$false
Location	Name		ResourceGroupName
--------	----		-----------------
eastus		sqlvm1		ResourceGroup01

Update a SQL virtual machine to disable auto backup.

Example 5

Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' `
-AutoPatchingSettingDayOfWeek Thursday `
-AutoPatchingSettingMaintenanceWindowDuration 120 -AutoPatchingSettingMaintenanceWindowStartingHour 3 -AutoPatchingSettingEnable
Location	Name		ResourceGroupName
--------	----		-----------------
eastus		sqlvm1		ResourceGroup01

Update a SQL virtual machine to enable auto patching.

Example 6

Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -AutoPatchingSettingEnable:$false
Location	Name		ResourceGroupName
--------	----		-----------------
eastus		sqlvm1		ResourceGroup01

Update a SQL virtual machine to disable auto patching.

Example 7

Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -AssessmentSettingEnable
Location	Name		ResourceGroupName
--------	----		-----------------
eastus		sqlvm1		ResourceGroup01

Update a SQL virtual machine to enable assessment.

Example 8

# $pwd is the password for cluster accounts
$securepwd = ConvertTo-SecureString -String $pwd -AsPlainText -Force
Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' `
-SqlVirtualMachineGroupResourceId '<group resource id>' `
-WsfcDomainCredentialsClusterBootstrapAccountPassword $securepwd `
-WsfcDomainCredentialsClusterOperatorAccountPassword $securepwd `
-WsfcDomainCredentialsSqlServiceAccountPassword $securepwd
Location	Name		ResourceGroupName
--------	----		-----------------
eastus		sqlvm1		ResourceGroup01

Update a SQL virtual machine to add it to a SQL VM group.

Example 9

Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -SqlVirtualMachineGroupResourceId ''
Location	Name		ResourceGroupName
--------	----		-----------------
eastus		sqlvm1		ResourceGroup01

Update a SQL virtual machine to remove it from a SQL VM group.

Example 10

Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -Tag @{'newkey'='newvalue'} -AsJob
Location	Name		ResourceGroupName
--------	----		-----------------
eastus		sqlvm1		ResourceGroup01

Update a SQL virtual machine's tag as a background job.

Example 11

Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -IdentityType 'SystemAssigned'
Location	Name		ResourceGroupName
--------	----		-----------------
eastus		sqlvm1		ResourceGroup01

Update a SQL virtual machine to enable Microsoft Entra authentication using "System-assigned managed identity"

Example 12

Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -IdentityType 'UserAssigned' -ManagedIdentityClientId '11111111-2222-3333-4444-555555555555'
Location	Name		ResourceGroupName
--------	----		-----------------
eastus		sqlvm1		ResourceGroup01

Update a SQL virtual machine to enable Microsoft Entra authentication using "User-assigned managed identity"

Parameters

-AsJob

Run the command as a job

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AssessmentSettingEnable

Enable or disable SQL best practices Assessment feature on SQL virtual machine.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AssessmentSettingRunImmediately

Run SQL best practices Assessment immediately on SQL virtual machine.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingBackupScheduleType

Backup schedule type.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingBackupSystemDb

Include or exclude system databases from auto backup.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingDaysOfWeek

Days of the week for the backups when FullBackupFrequency is set to Weekly.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingEnable

Enable or disable autobackup on SQL virtual machine.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingEnableEncryption

Enable or disable encryption for backup on SQL virtual machine.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingFullBackupFrequency

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingFullBackupStartTime

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

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingFullBackupWindowHour

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

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingLogBackupFrequency

Frequency of log backups. 5-60 minutes.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingPassword

Password for encryption on backup.

Parameter properties

Type:SecureString
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingRetentionPeriod

Retention period of backup: 1-90 days.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingStorageAccessKey

Storage account key where backup will be taken to.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingStorageAccountUrl

Storage account url where backup will be taken to.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoBackupSettingStorageContainerName

Storage container name where backup will be taken to.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoPatchingSettingDayOfWeek

Day of week to apply the patch on.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoPatchingSettingEnable

Enable or disable autopatching on SQL virtual machine.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoPatchingSettingMaintenanceWindowDuration

Duration of patching.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AutoPatchingSettingMaintenanceWindowStartingHour

Hour of the day when patching is initiated. Local VM time.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRMContext, AzureCredential

Parameter sets

-EnableAutomaticUpgrade

Enable automatic upgrade of Sql IaaS extension Agent.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-IdentityType

Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-InputObject

Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

Parameter properties

Type:ISqlVirtualMachineIdentity
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-LicenseType

SQL Server license type.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ManagedIdentityClientId

The client Id of the Managed Identity to query Microsoft Graph API. An empty string must be used for the system assigned Managed Identity

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Name

Name of the SQL virtual machine.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:SqlVirtualMachineName, SqlVMName

Parameter sets

-NoWait

Run the command asynchronously

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Offer

SQL image offer. Examples include SQL2016-WS2016, SQL2017-WS2016.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ResourceGroupName

Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ScheduleDayOfWeek

Day of the week to run assessment.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ScheduleEnable

Enable or disable assessment schedule on SQL virtual machine.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ScheduleMonthlyOccurrence

Occurrence of the DayOfWeek day within a month to schedule assessment. Takes values: 1,2,3,4 and -1. Use -1 for last DayOfWeek day of the month

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ScheduleStartTime

Time of the day in HH:mm format. Eg. 17:30

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ScheduleWeeklyInterval

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

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Sku

SQL Server edition type.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-SqlManagementType

SQL Server Management type.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-SqlVirtualMachineGroupResourceId

ARM resource id of the SQL virtual machine group this SQL virtual machine is or will be part of.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-SubscriptionId

Subscription ID that identifies an Azure subscription.

Parameter properties

Type:String
Default value:(Get-AzContext).Subscription.Id
Supports wildcards:False
DontShow:False

Parameter sets

-Tag

Resource tags.

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-VirtualMachineResourceId

ARM Resource id of underlying virtual machine created from SQL marketplace image.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

-WsfcDomainCredentialsClusterBootstrapAccountPassword

Cluster bootstrap account password.

Parameter properties

Type:SecureString
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-WsfcDomainCredentialsClusterOperatorAccountPassword

Cluster operator account password.

Parameter properties

Type:SecureString
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-WsfcDomainCredentialsSqlServiceAccountPassword

SQL service account password.

Parameter properties

Type:SecureString
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-WsfcStaticIP

Domain credentials for setting up Windows Server Failover Cluster for SQL availability group.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

ISqlVirtualMachineIdentity

Outputs

Microsoft.Azure.PowerShell.Cmdlets.SqlVirtualMachine.Models.ISqlVirtualMachine


Feedback

Was this page helpful?