New-​Azure​VM​Sql​Server​Auto​Backup​Config

Creates a configuration object for SQL Server automatic backup.

Syntax

New-AzureVMSqlServerAutoBackupConfig
   [-ResourceGroupName] <String>
   [-Enable]
   [[-RetentionPeriodInDays] <Int32>]
   [-EnableEncryption]
   [[-CertificatePassword] <SecureString>]
   [[-StorageUri] <Uri>]
   [[-StorageContext] <AzureStorageContext>]
   [[-StorageKey] <SecureString>]
   [-BackupScheduleType <String>]
   [-BackupSystemDbs]
   [-FullBackupFrequency <String>]
   [-FullBackupStartHour <Int32>]
   [-FullBackupWindowInHours <Int32>]
   [-LogBackupFrequencyInMinutes <Int32>]
   [<CommonParameters>]

Description

The New-AzureVMSqlServerAutoBackupConfig cmdlet creates a configuration object for SQL Server automatic backup.

Examples

Example 1: Create an automatic backup configuration using storage URI and account key

PS C:\>$AutoBackupConfig = New-AzureVMSqlServerAutoBackupConfig -Enable -RetentionPeriod 10 -StorageUri "\\contoso\StorageGeneral" -StorageKey "< Storage Key for ContosoGeneral >"
Enable                : True
EnableEncryption      : False
RetentionPeriodInDays : 10

This command creates an automatic backup configuration object by specifying storage URI and account key. Automatic backup is enabled and automatic backups are kept for 10 days. The command stores the result in the $AutoBackupConfig variable. You can specify this configuration item for other cmdlets, such as the Set-AzureRmVMSqlServerExtension cmdlet.

Example 2: Create an automatic backup configuration using storage context

PS C:\>$StorageContext = New-AzureStorageContext -StorageAccountName "ContosoGeneral" -StorageAccountKey "< Storage Key for ContosoGeneral >"
PS C:\> $AutoBackupConfig = New-AzureVMSqlServerAutoBackupConfig -StorageContext $StorageContext -Enable -RetentionPeriod 10
Enable                : True
EnableEncryption      : False
RetentionPeriodInDays : 10

The first command creates a storage context, and then stores it in the $StorageContext variable. For more information, see New-AzureStorageContext.

The second command creates an automatic backup configuration object by specifying the storage context in $StorageContext. Automatic backup is enabled and automatic backups are kept for 10 days.

Example 3: Create an automatic backup configuration using storage context with encryption and password

PS C:\>$StorageContext = New-AzureVMSqlServerAutoBackupConfig -StorageContext $StorageContext -Enable -RetentionPeriod 10 -EnableEncryption -CertificatePassword $CertificatePassword
Enable                : True
EnableEncryption      : True
RetentionPeriodInDays : 10

This command creates and stores an automatic backup configuration object. The command specifies the storage context created in a previous example. The command enables encryption with password. The password was previously stored as a secure string in the $CertificatePassword variable. To create a secure string, use the ConvertTo-SecureString cmdlet.

Required Parameters

-ResourceGroupName

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

Type:String
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-BackupScheduleType

Backup schedule type, manual or automated

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-BackupSystemDbs

Backup system databases

Type:SwitchParameter
Position:Named
Default value:False
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-CertificatePassword

Specifies a password to encrypt the certificate that is used to perform SQL Server encrypted backups.

Type:SecureString
Position:5
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Enable

Indicates that automated backup for the SQL Server virtual machine is enabled. If you specify this parameter, automated backup sets a backup schedule for all current and new databases. This updates your Managed Backup settings to follow this schedule.

Type:SwitchParameter
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-EnableEncryption

Indicates that this cmdlet enables encryption.

Type:SwitchParameter
Position:4
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-FullBackupFrequency

Sql Server Full Backup frequency, daily or weekly

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-FullBackupStartHour

Hour of the day (0-23) when the Sql Server Full Backup should start

Type:Int32
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-FullBackupWindowInHours

Sql Server Full Backup window in hours

Type:Int32
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-LogBackupFrequencyInMinutes

Sql Server Log Backup frequency, once every 1-60 minutes

Type:Int32
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-RetentionPeriodInDays

Specifies the number of days to retain a backup.

Type:Int32
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-StorageContext

Specifies the storage account that will be used to store backups. To obtain an AzureStorageContext object, use the New-AzureStorageContext cmdlet. The default is the storage account that is associated with the SQL Server virtual machine.

Type:AzureStorageContext
Position:6
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-StorageKey

Specifies the storage key of the blob storage account.

Type:SecureString
Position:6
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-StorageUri

Specifies the Uniform Resource Identifier (URI) of the blob storage account.

Type:Uri
Position:5
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False