[英]Unable to backup Function/Web App using Azure Cli az webapp config backup create
我在執行 Azure CLI 命令備份我的 Azure 應用程序服務時遇到問題:
客戶端命令:
az webapp config backup create --resource-group --webapp-name
--backup-name testbackup --container-url
我生成了一個新的 SaS 密鑰與命令一起傳遞。
這是正確的方法嗎?
客戶端 Output:
{ "backupId": 64862, "backupItemName": "testbackup", "blobName": "testbackup", "correlationId": "3e9ae4d0-9aa9-46e0-9926-53ec1ef6ef2c", "created": "2020-09-22T08:50:35.555268+00:00", "databases": null, "finishedTimeStamp": null, "id": "value", "kind": null, "lastRestoreTimeStamp": null, "location": "Central US", "log": null, "name": "testbackuppr", "resourceGroup": "RG-POC", "scheduled": false, **"sizeInBytes": 0,** "status": "Created", "storageAccountUrl": "", "type": "Microsoft.Web/sites", "websiteSizeInBytes": null }
門戶中的日志信息:存儲訪問失敗。 遠程服務器返回錯誤:(404) 未找到。請刪除並重新創建備份計划以緩解。
存儲帳戶或其訪問權限似乎有問題。 在執行az webapp config backup create
命令之前,請確保你有一個有效的存儲帳戶、一個存儲容器和一個具有適當到期日期的 SAS 令牌。 可以使用az storage container generate-sas
命令生成 SAS 令牌。
以下腳本對我有用:
#!/bin/bash
groupname="myResourceGroup"
planname="myAppServicePlan"
webappname=mywebapp$RANDOM
storagename=mywebappstorage$RANDOM
location="WestEurope"
container="appbackup"
backupname="backup1"
expirydate=$(date -I -d "$(date) + 1 month")
# Create a Resource Group
az group create --name $groupname --location $location
# Create a Storage Account
az storage account create --name $storagename --resource-group $groupname --location $location \
--sku Standard_LRS
# Create a storage container
az storage container create --account-name $storagename --name $container
# Generates an SAS token for the storage container, valid for one month.
# NOTE: You can use the same SAS token to make backups in App Service until --expiry
sastoken=$(az storage container generate-sas --account-name $storagename --name $container \
--expiry $expirydate --permissions rwdl --output tsv)
# Construct the SAS URL for the container
sasurl=https://$storagename.blob.core.windows.net/$container?$sastoken
# Create an App Service plan in Standard tier. Standard tier allows one backup per day.
az appservice plan create --name $planname --resource-group $groupname --location $location \
--sku S1
# Create a web app
az webapp create --name $webappname --plan $planname --resource-group $groupname
# Create a one-time backup
az webapp config backup create --resource-group $groupname --webapp-name $webappname \
--backup-name $backupname --container-url $sasurl
# List statuses of all backups that are complete or currently executing.
az webapp config backup list --resource-group $groupname --webapp-name $webappname
參考:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.