The Backup-AzRecoveryServicesBackupItem cmdlet takes an adhoc backup of protected Azure backup item.
Using this cmdlet you can do an initial backup immediately after you enable protection or start a backup if a scheduled backup fails.
This cmdlet can also be used for custom retention with or without expiry date - refer parameters help text for more details.
The first command gets the Backup container of type AzureVM named pstestv2vm1, and then stores it in the $NamedContainer variable.
The second command gets the Backup item corresponding to the container in $NamedContainer, and then stores it in the $Item variable.
The last command triggers the backup job for the Backup item in $Item with an expiry time of 60 days from now, default value for expiry time is 30 days if not specified.
Example 2
Starts a backup for a Backup item. (autogenerated)
Specifies an expiry time for the Recovery point as a DateTime object, if nothing is given it takes the default value of 30 days. Applicable to VM, SQL (for only Copy-only-full backup type), AFS backup items.
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.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.