01 Run storage account create command (Windows/macOS/Linux) to create the Microsoft Azure Storage account required to hold your Azure App Service application backups:
az storage account create
--name ccwebstorageaccount
--resource-group cloud-shell-storage-westeurope
--sku Standard_LRS
02 The command output should return the information available for the new Azure Storage account:
{
"accessTier": "Hot",
"allowBlobPublicAccess": true,
"allowCrossTenantReplication": null,
"allowSharedKeyAccess": null,
"allowedCopyScope": null,
"azureFilesIdentityBasedAuthentication": null,
"blobRestoreStatus": null,
"creationTime": "2023-10-31T15:24:47.566177+00:00",
"customDomain": null,
"defaultToOAuthAuthentication": null,
"dnsEndpointType": null,
"enableHttpsTrafficOnly": true,
"enableNfsV3": null,
"extendedLocation": null,
"failoverInProgress": null,
"geoReplicationStats": null,
"identity": null,
"immutableStorageWithVersioning": null,
"isHnsEnabled": null,
"isLocalUserEnabled": null,
"isSftpEnabled": null,
"keyPolicy": null,
"kind": "StorageV2",
"largeFileSharesState": null,
"lastGeoFailoverTime": null,
"location": "westeurope",
"minimumTlsVersion": "TLS1_0",
"name": "ccwebstorageaccount",
"networkRuleSet": {
"bypass": "AzureServices",
"defaultAction": "Allow",
"ipRules": [],
"resourceAccessRules": null,
"virtualNetworkRules": []
},
"primaryEndpoints": {
"blob": "https://ccwebstorageaccount.blob.core.windows.net/",
"dfs": "https://ccwebstorageaccount.dfs.core.windows.net/",
"file": "https://ccwebstorageaccount.file.core.windows.net/",
"internetEndpoints": null,
"microsoftEndpoints": null,
"queue": "https://ccwebstorageaccount.queue.core.windows.net/",
"table": "https://ccwebstorageaccount.table.core.windows.net/",
"web": "https://ccwebstorageaccount.z6.web.core.windows.net/"
},
"primaryLocation": "westeurope",
"privateEndpointConnections": [],
"provisioningState": "Succeeded",
"publicNetworkAccess": null,
"resourceGroup": "cloud-shell-storage-westeurope",
"routingPreference": null,
"sasPolicy": null,
"secondaryEndpoints": null,
"secondaryLocation": null,
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"statusOfPrimary": "available",
"statusOfSecondary": null,
"storageAccountSkuConversionStatus": null,
"tags": {},
"type": "Microsoft.Storage/storageAccounts"
}
03 Run storage container create command (Windows/macOS/Linux) using the name of the newly created Microsoft Azure Storage account as the command parameter to create the storage container required to store your Azure App Service application backups:
az storage container create
--account-name ccwebstorageaccount
--name cc-app-backup-container
04 The command output should return the storage container create request confirmation status:
05 Run storage container generate-sas command (Windows/macOS/Linux) to generate a Shared Access Signature (SAS) token for the storage container created at the previous steps. A SAS token enables you to grant limited access to the containers and the blobs within your storage account. When you create a SAS token, you specify its constraints, including which permissions it has on those Azure resources, and how long the token is valid:
az storage container generate-sas
--name cc-app-backup-container
--account-name ccwebstorageaccount
--permissions rwdl
--expiry 2024-05-01
06 The command output should return the new Shared Access Signature (SAS) token:
"se=2024-05-01&sp=rwdl&sv=2022-11-02&sr=c&sig=abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
07 Run webapp config backup update command (Windows/macOS/Linux) to enable custom backups for the selected Azure App Service application by configuring a backup schedule for the specified app. Construct the required storage container URL using the following format: "https://<storage-account-name>.blob.core.windows.net/<storage-container-name>?<storage-container-sas-token>"
(the command does not produce an output):
az webapp config backup update
--webapp-name cc-aspnet-web-app
--resource-group cloud-shell-storage-westeurope
--backup-name cc-custom-daily-backup
--container-url https://ccwebstorageaccount.blob.core.windows.net/cc-app-backup-container?se=2024-05-01&sp=rwdl&sv=2022-11-02&sr=c&sig=abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd
--frequency 1d
--retention 7
--retain-one true
08 Repeat step no. 7 for each Azure App Service application that you want to configure in order to enable and configure custom backups, available within the current subscription.
09 Repeat steps no. 1 – 8 for each subscription created in your Microsoft Azure cloud account.