New-AzVMSqlServerAutoBackupConfig
Creates a configuration object for SQL Server automatic backup.
Syntax
New-AzVMSqlServerAutoBackupConfig
[-ResourceGroupName] <String>
[-Enable]
[[-RetentionPeriodInDays] <Int32>]
[-EnableEncryption]
[[-CertificatePassword] <SecureString>]
[[-StorageUri] <Uri>]
[[-StorageKey] <SecureString>]
[-BackupSystemDbs]
[-BackupScheduleType <String>]
[-FullBackupFrequency <String>]
[-FullBackupStartHour <Int32>]
[-FullBackupWindowInHours <Int32>]
[-LogBackupFrequencyInMinutes <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzVMSqlServerAutoBackupConfig
[-ResourceGroupName] <String>
[-Enable]
[[-RetentionPeriodInDays] <Int32>]
[-EnableEncryption]
[[-CertificatePassword] <SecureString>]
[[-StorageContext] <IStorageContext>]
[[-StorageUri] <Uri>]
[[-StorageKey] <SecureString>]
[-BackupSystemDbs]
[-BackupScheduleType <String>]
[-FullBackupFrequency <String>]
[-FullBackupStartHour <Int32>]
[-FullBackupWindowInHours <Int32>]
[-LogBackupFrequencyInMinutes <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The New-AzVMSqlServerAutoBackupConfig cmdlet creates a configuration object for SQL Server automatic backup.
Examples
Example 1: Create an automatic backup configuration using storage URI and account key
$AutoBackupConfig = New-AzVMSqlServerAutoBackupConfig -Enable -RetentionPeriodInDays 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-AzVMSqlServerExtension cmdlet.
Example 2: Create an automatic backup configuration using storage context
$StorageContext = New-AzStorageContext -StorageAccountName "ContosoGeneral" -StorageAccountKey "< Storage Key for ContosoGeneral >"
$AutoBackupConfig = New-AzVMSqlServerAutoBackupConfig -StorageContext $StorageContext -Enable -RetentionPeriodInDays 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-AzStorageContext. 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
$StorageContext = New-AzVMSqlServerAutoBackupConfig -StorageContext $StorageContext -Enable -RetentionPeriodInDays 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.
Parameters
-BackupScheduleType
Backup schedule type, manual or automated
Type: | String |
Accepted values: | Manual, Automated |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-BackupSystemDbs
Backup system databases
Type: | SwitchParameter |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-CertificatePassword
Specifies a password to encrypt the certificate that is used to perform SQL Server encrypted backups.
Type: | SecureString |
Position: | 4 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
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: | 1 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-EnableEncryption
Indicates that this cmdlet enables encryption.
Type: | SwitchParameter |
Position: | 3 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-FullBackupFrequency
Sql Server Full Backup frequency, daily or weekly
Type: | String |
Accepted values: | Daily, Weekly |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-FullBackupStartHour
Hour of the day (0-23) when the Sql Server Full Backup should start
Type: | Nullable<T>[Int32] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-FullBackupWindowInHours
Sql Server Full Backup window in hours
Type: | Nullable<T>[Int32] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-LogBackupFrequencyInMinutes
Sql Server Log Backup frequency, once every 1-60 minutes
Type: | Nullable<T>[Int32] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceGroupName
Specifies the name of the resource group of the virtual machine.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-RetentionPeriodInDays
Specifies the number of days to retain a backup.
Type: | Int32 |
Position: | 2 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StorageContext
Specifies the storage account that will be used to store backups. To obtain an AzureStorageContext object, use the New-AzStorageContext cmdlet. The default is the storage account that is associated with the SQL Server virtual machine.
Type: | IStorageContext |
Position: | 5 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StorageKey
Specifies the storage key of the blob storage account.
Type: | SecureString |
Position: | 5 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StorageUri
Specifies the Uniform Resource Identifier (URI) of the blob storage account.
Type: | Uri |
Position: | 4 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Inputs
Nullable<T>[[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
Outputs
Related Links
Azure PowerShell