Update-AzSqlVM
Updates a SQL virtual machine.
Update-AzSqlVM
-Name <String>
-ResourceGroupName <String>
[-SubscriptionId <String>]
[-LicenseType <SqlServerLicenseType>]
[-Offer <String>]
[-Sku <SqlImageSku>]
[-SqlManagementType <SqlManagementMode>]
[-Tag <Hashtable>]
[-AutoBackupSettingBackupScheduleType <BackupScheduleType>]
[-AutoBackupSettingBackupSystemDb]
[-AutoBackupSettingDaysOfWeek <AutoBackupDaysOfWeek[]>]
[-AutoBackupSettingEnable]
[-AutoBackupSettingEnableEncryption]
[-AutoBackupSettingFullBackupFrequency <FullBackupFrequencyType>]
[-AutoBackupSettingFullBackupStartTime <Int32>]
[-AutoBackupSettingFullBackupWindowHour <Int32>]
[-AutoBackupSettingLogBackupFrequency <Int32>]
[-AutoBackupSettingPassword <SecureString>]
[-AutoBackupSettingRetentionPeriod <Int32>]
[-AutoBackupSettingStorageAccessKey <String>]
[-AutoBackupSettingStorageAccountUrl <String>]
[-AutoBackupSettingStorageContainerName <String>]
[-AutoPatchingSettingDayOfWeek <DayOfWeek>]
[-AutoPatchingSettingEnable]
[-AutoPatchingSettingMaintenanceWindowDuration <Int32>]
[-AutoPatchingSettingMaintenanceWindowStartingHour <Int32>]
[-AssessmentSettingEnable]
[-AssessmentSettingRunImmediately]
[-ScheduleDayOfWeek <AssessmentDayOfWeek>]
[-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>]
Update-AzSqlVM
-InputObject <ISqlVirtualMachineIdentity>
[-LicenseType <SqlServerLicenseType>]
[-Offer <String>]
[-Sku <SqlImageSku>]
[-SqlManagementType <SqlManagementMode>]
[-Tag <Hashtable>]
[-AutoBackupSettingBackupScheduleType <BackupScheduleType>]
[-AutoBackupSettingBackupSystemDb]
[-AutoBackupSettingDaysOfWeek <AutoBackupDaysOfWeek[]>]
[-AutoBackupSettingEnable]
[-AutoBackupSettingEnableEncryption]
[-AutoBackupSettingFullBackupFrequency <FullBackupFrequencyType>]
[-AutoBackupSettingFullBackupStartTime <Int32>]
[-AutoBackupSettingFullBackupWindowHour <Int32>]
[-AutoBackupSettingLogBackupFrequency <Int32>]
[-AutoBackupSettingPassword <SecureString>]
[-AutoBackupSettingRetentionPeriod <Int32>]
[-AutoBackupSettingStorageAccessKey <String>]
[-AutoBackupSettingStorageAccountUrl <String>]
[-AutoBackupSettingStorageContainerName <String>]
[-AutoPatchingSettingDayOfWeek <DayOfWeek>]
[-AutoPatchingSettingEnable]
[-AutoPatchingSettingMaintenanceWindowDuration <Int32>]
[-AutoPatchingSettingMaintenanceWindowStartingHour <Int32>]
[-AssessmentSettingEnable]
[-AssessmentSettingRunImmediately]
[-ScheduleDayOfWeek <AssessmentDayOfWeek>]
[-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>]
Updates a SQL virtual machine.
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.
$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.
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.
Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -AutoBackupSettingEnable:$false
Location Name ResourceGroupName
-------- ---- -----------------
eastus sqlvm1 ResourceGroup01
Update a SQL virtual machine to disable auto backup.
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.
Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -AutoPatchingSettingEnable:$false
Location Name ResourceGroupName
-------- ---- -----------------
eastus sqlvm1 ResourceGroup01
Update a SQL virtual machine to disable auto patching.
Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -AssessmentSettingEnable
Location Name ResourceGroupName
-------- ---- -----------------
eastus sqlvm1 ResourceGroup01
Update a SQL virtual machine to enable assessment.
$securepwd = ConvertTo-SecureString -String "****" -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.
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.
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.
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"
Update-AzSqlVM -ResourceGroupName 'ResourceGroup01' -Name 'sqlvm1' -IdentityType 'UserAssigned' -ManagedIdentityClientId '00001111-aaaa-2222-bbbb-3333cccc4444'
Location Name ResourceGroupName
-------- ---- -----------------
eastus sqlvm1 ResourceGroup01
Update a SQL virtual machine to enable Microsoft Entra authentication using "User-assigned managed identity"
Run the command as a job
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Enable or disable SQL best practices Assessment feature on SQL virtual machine.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Run SQL best practices Assessment immediately on SQL virtual machine.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Backup schedule type.
Type: | BackupScheduleType |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Include or exclude system databases from auto backup.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Days of the week for the backups when FullBackupFrequency is set to Weekly.
Type: | AutoBackupDaysOfWeek[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Enable or disable autobackup on SQL virtual machine.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Enable or disable encryption for backup on SQL virtual machine.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Frequency of full backups. In both cases, full backups begin during the next scheduled time window.
Type: | FullBackupFrequencyType |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Start time of a given day during which full backups can take place. 0-23 hours.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Duration of the time window of a given day during which full backups can take place. 1-23 hours.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Frequency of log backups. 5-60 minutes.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Password for encryption on backup.
Type: | SecureString |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Retention period of backup: 1-90 days.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Storage account key where backup will be taken to.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Storage account url where backup will be taken to.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Storage container name where backup will be taken to.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Day of week to apply the patch on.
Type: | DayOfWeek |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Enable or disable autopatching on SQL virtual machine.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Duration of patching.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Hour of the day when patching is initiated. Local VM time.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | PSObject |
Aliases: | AzureRMContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Enable automatic upgrade of Sql IaaS extension Agent.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
Type: | ISqlVirtualMachineIdentity |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
SQL Server license type.
Type: | SqlServerLicenseType |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The client Id of the Managed Identity to query Microsoft Graph API. An empty string must be used for the system assigned Managed Identity
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Name of the SQL virtual machine.
Type: | String |
Aliases: | SqlVirtualMachineName, SqlVMName |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Run the command asynchronously
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
SQL image offer. Examples include SQL2016-WS2016, SQL2017-WS2016.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Day of the week to run assessment.
Type: | AssessmentDayOfWeek |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Enable or disable assessment schedule on SQL virtual machine.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
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
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Time of the day in HH:mm format. Eg. 17:30
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Number of weeks to schedule between 2 assessment runs. Takes value from 1-6
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
SQL Server edition type.
Type: | SqlImageSku |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
SQL Server Management type.
Type: | SqlManagementMode |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
ARM resource id of the SQL virtual machine group this SQL virtual machine is or will be part of.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Subscription ID that identifies an Azure subscription.
Type: | String |
Position: | Named |
Default value: | (Get-AzContext).Subscription.Id |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Resource tags.
Type: | Hashtable |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
ARM Resource id of underlying virtual machine created from SQL marketplace image.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Cluster bootstrap account password.
Type: | SecureString |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Cluster operator account password.
Type: | SecureString |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
SQL service account password.
Type: | SecureString |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Domain credentials for setting up Windows Server Failover Cluster for SQL availability group.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Azure PowerShell feedback
Azure PowerShell is an open source project. Select a link to provide feedback: