Delete a backup for a web using Azure PowerShell

This sample script creates a web app in App Service with its related resources, and then creates a one-time backup for it.

To run this script, you need an existing backup for a web app. To create one, see Backup up a web app or Create a scheduled backup for a web app.

Sample script

Note

We recommend that you use the Azure Az PowerShell module to interact with Azure. See Install Azure PowerShell to get started. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.

$resourceGroupName = "myResourceGroup"
$webappname = "<replace-with-your-app-name>"

# List statuses of all backups that are complete or currently executing.
Get-AzWebAppBackupList -ResourceGroupName $resourceGroupName -Name $webappname

# Note the BackupID property of the backup you want to delete

# Delete the backup by specifying the BackupID
Remove-AzWebAppBackup -ResourceGroupName $resourceGroupName -Name $webappname `
-BackupId '<replace-with-BackupID>'

Clean up deployment

After the script sample has been run, the following command can be used to remove the resource group, web app, and all related resources.

Remove-AzResourceGroup -Name myResourceGroup -Force

Script explanation

This script uses the following commands. Each command in the table links to command specific documentation.

Command Notes
Get-AzWebAppBackupList Gets a list of backups for a web app.
Remove-AzWebAppBackup Removes the specified backup of a web app.

Next steps

For more information on the Azure PowerShell module, see Azure PowerShell documentation.

Additional Azure PowerShell samples for Azure App Service Web Apps can be found in the Azure PowerShell samples.