Ta bort säkerhetskopiering för en webb med Azure PowerShell

Det här exempelskriptet skapar en webbapp i App Service med dess relaterade resurser, och skapar sedan en tidsbegränsad säkerhetskopia för webbappen.

Om du vill köra skriptet behöver du en befintlig säkerhetskopia för en webbapp. Information om hur du skapar en sådan finns i Säkerhetskopiera en webbapp eller Skapa en schemalagd säkerhetskopiering för en webbapp.

Exempelskript

Anteckning

Vi rekommenderar att du använder Azure Az PowerShell-modulen för att interagera med Azure. Se Installera Azure PowerShell för att komma igång. Information om hur du migrerar till Az PowerShell-modulen finns i artikeln om att migrera Azure PowerShell från AzureRM till Az.

# 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.

$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>'

Rensa distribution

När skriptet har körts kan följande kommando användas för att ta bort resursgruppen, webbappen och alla relaterade resurser.

Remove-AzResourceGroup -Name myResourceGroup -Force

Förklaring av skript

Det här skriptet använder följande kommandon. Varje kommando i tabellen länkar till kommandospecifik dokumentation.

Kommando Kommentarer
Get-AzWebAppBackupList Hämtar en lista över säkerhetskopior för en webbapp.
Remove-AzWebAppBackup Tar bort den angivna säkerhetskopian av en webbapp.

Nästa steg

Mer information om Azure PowerShell-modulen finns i Azure PowerShell-dokumentationen.

Ytterligare Azure PowerShell exempel för Azure App Service Web Apps finns i de Azure PowerShell exemplen.