Edit

Share via


Set-AzVMSqlServerExtension

Sets the Azure SQL Server extension on a virtual machine.

Syntax

Default (Default)

Set-AzVMSqlServerExtension
    [[-Version] <String>]
    [-ResourceGroupName] <String>
    [-VMName] <String>
    [[-Name] <String>]
    [[-AutoPatchingSettings] <AutoPatchingSettings>]
    [[-AutoBackupSettings] <AutoBackupSettings>]
    [[-KeyVaultCredentialSettings] <KeyVaultCredentialSettings>]
    [[-Location] <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Set-AzVMSqlServerExtension cmdlet sets the AzureSQL Server extension on a virtual machine.

Examples

Example 1: Set automatic patching settings on a virtual machine

$AutoPatchingConfig = New-AzVMSqlServerAutoPatchingConfig -Enable -DayOfWeek "Thursday" -MaintenanceWindowStartingHour 11 -MaintenanceWindowDuration 120 -PatchCategory "Important"
Get-AzVM -ResourceGroupName "testrg" -Name "VirtualMachine11" | Set-AzVMSqlServerExtension -AutoPatchingSettings $AutoPatchingConfig | Update-AzVM

The first command creates a configuration object by using the New-AzVMSqlServerAutoPatchingConfig cmdlet. The command stores the configuration in the $AutoPatchingConfig variable. The second command gets the virtual machine named VirtualMachine11 in the Resource Group testrg by using the Get-AzVM cmdlet. The command passes that object to the current cmdlet by using the pipeline operator. The current cmdlet sets the automatic patching settings in $AutoPatchingConfig for the virtual machine. The command passes the virtual machine to the Update-AzVM cmdlet.

Example 2: Set automatic backup settings on a virtual machine

$AutoBackupConfig = New-AzVMSqlServerAutoBackupConfig -Enable -RetentionPeriodInDays 10 -StorageUri $StorageUrl -StorageKey $StorageAccountKeySecure
Get-AzVM -ResourceGroupName "testrg" -Name "VirtualMachine11" | Set-AzVMSqlServerExtension -AutoBackupSettings $AutoBackupConfig | Update-AzVM

The first command creates a configuration object by using the New-AzVMSqlServerAutoBackupConfig cmdlet. The command stores the configuration in the $AutoBackupConfig variable. The second command gets the virtual machine named VirtualMachine11 in the Resource Group testrg, and then passes it to the current cmdlet. The current cmdlet sets the automatic backup settings in $AutoBackupConfig for the virtual machine. The command passes the virtual machine to the Update-AzVM cmdlet.

Parameters

-AutoBackupSettings

Specifies the automatic SQL Server backup settings. To create an AutoBackupSettings object , use the New-AzVMSqlServerAutoBackupConfig cmdlet.

Parameter properties

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

Parameter sets

(All)
Position:6
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-AutoPatchingSettings

Specifies the automatic SQL Server patching settings. To create an AutoPatchingSettings object , use the New-AzVMSqlServerAutoPatchingConfig cmdlet.

Parameter properties

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

Parameter sets

(All)
Position:5
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KeyVaultCredentialSettings

The Set-AzVMSqlServerExtension cmdlet sets the AzureSQL Server extension on a virtual machine.

Parameter properties

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

Parameter sets

(All)
Position:7
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Location

Specifies the location of the virtual machine.

Parameter properties

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

Parameter sets

(All)
Position:8
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

Specifies the name of the SQL Server the extension.

Parameter properties

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

Parameter sets

(All)
Position:4
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceGroupName

Specifies the name of the resource group of the virtual machine.

Parameter properties

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

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Version

Specifies the version of the SQL Server extension.

Parameter properties

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

Parameter sets

(All)
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-VMName

Specifies the name of the virtual machine on which this cmdlet sets the SQL Server extension.

Parameter properties

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

Parameter sets

(All)
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

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

String

AutoPatchingSettings

AutoBackupSettings

KeyVaultCredentialSettings

Outputs

PSAzureOperationResponse