Editar

Compartir a través de


Enable-AzRecoveryServicesBackupAutoProtection

The Enable-AzRecoveryServicesBackupAutoProtection cmdlet sets up automatic protection of current and any future SQL DBs within the given instance with the supplied policy.

Syntax

Enable-AzRecoveryServicesBackupAutoProtection
      [-InputItem] <ProtectableItemBase>
      [-BackupManagementType] <BackupManagementType>
      [-WorkloadType] <WorkloadType>
      [-Policy] <PolicyBase>
      [-PassThru]
      [-VaultId <String>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

This command allows users to automatically protect all existing unprotected SQL DBs and any DB which will be added later with the given policy. Since the instruction is to back up all future DBs, the operation is done at a SQLInstance level, Azure backup service will then regularly scan auto-protected containers for any new DBs and automatically protect them.

Examples

Example 1

$Pol = Get-AzRecoveryServicesBackupProtectionPolicy -Name "DefaultSQLPolicy"
$SQLInstance = Get-AzRecoveryServicesBackupProtectableItem -workloadType MSSQL -ItemType SQLInstance -VaultId $targetVault.ID -Name "MSSQLInstance" -ServerName "TestSQLServer"
Enable-AzRecoveryServicesBackupAutoProtection -InputItem $SQLInstance -BackupManagementType AzureWorkload -WorkloadType MSSQL -Policy $Pol -VaultId $targetvault.ID

The first cmdlet gets a default policy object, and then stores it in the $Pol variable. The second cmdlet fetches the relevant SQLInstance which is a protectable item. The 3rd command then sets up auto protection for this instance using the policy in $Pol.

Example 2

This commands allows users to automatically protect all existing unprotected DBs and any DB which will be added later with the given policy. (autogenerated)

Enable-AzRecoveryServicesBackupAutoProtection -BackupManagementType AzureVM -InputItem <ProtectableItemBase> -Policy $Pol -VaultId $vault.ID -WorkloadType AzureVM

Parameters

-BackupManagementType

The class of resources being protected. Currently the values supported for this cmdlet are MAB, AzureWorkload, AzureVM

Type:BackupManagementType
Accepted values:AzureWorkload
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

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

-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

-InputItem

Specifies the protectable item object that can be passed as an input. The current supported value is a protectableItem object of type "SQLInstance".

Type:ProtectableItemBase
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PassThru

Return the result for auto protection.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Policy

Protection policy object.

Type:PolicyBase
Position:3
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-VaultId

ARM ID of the Recovery Services Vault.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WorkloadType

Workload type of the resource. The current supported values are AzureVM, WindowsServer, MSSQL

Type:WorkloadType
Accepted values:MSSQL, SAPHanaDatabase
Position:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Outputs

Object