...
The section below contains an example of how to restore the Azure File backup using the command line. In this example the backup is restored as a new to the existing File share. If you wish to restore backup to the existing a new File share instance, you need to adjust accordingly.
Code Block |
---|
export RESOURCE_GROUP=PT_Stratus export LOCATION="Southeast Asia" export STORAGE_ACCOUNT_NAME=uepeaks export STORAGE_ACCOUNT_KEY=$(az storage account keys list --account-name $STORAGE_ACCOUNT_NAME --query "[0].value") export STORAGE_ACCOUNT_ID=$(az storage account show --resource-group $RESOURCE_GROUP --name $STORAGE_ACCOUNT_NAME --query "id") export SUBSCRIPTION_ID=$(az account subscription list --query "[0].subscriptionId") export FILE_SHARE=$(az storage share list --account-name $STORAGE_ACCOUNT_NAME --account-key $STORAGE_ACCOUNT_KEY --query "[0].name") export FILE_BACKUP_VAULT=azurefilesvault export FILE_BACKUP_POLICY=MyBackupPolicy export CONTAINER_NAME=$(az backup container list --resource-group $RESOURCE_GROUP --vault-name $FILE_BACKUP_VAULT --backup-management-type AzureStorage --query "[0].name") export ITEM_NAME=$(az backup item list --resource-group $RESOURCE_GROUP --vault-name $FILE_BACKUP_VAULT --query "[0].name") # Fetch recovery points az backup recoverypoint list --vault-name $FILE_BACKUP_VAULT --resource-group $RESOURCE_GROUP --container-name $CONTAINER_NAME --backup-management-type azurestorage --item-name $ITEM_NAME --workload-type azurefileshare --out table # Command output as below: # Name Time Consistency # -------------- ------------------------- -------------------- # 68988215529834 2024-07-19T11:01:09+00:00 FileSystemConsistent # Create a new file share for restore purpose az storage share create --account-name $STORAGE_ACCOUNT_NAME --name $FILE_SHARE-restored # Full restore snapshot to newexisting file share az backup restore restore-azurefileshare --vault-name $FILE_BACKUP_VAULT --resource-group $RESOURCE_GROUP --rp-name 68988215529834 --container-name $CONTAINER_NAME --item-name $ITEM_NAME --restore-mode alternatelocation --target-storage-account $STORAGE_ACCOUNT_NAME --target-file-share $FILE_SHARE-restored --target-folder restoredataoriginallocation --resolve-conflict overwrite --out table # Track job status az backup job show --name 249c1bbb-da9f-4b3b-b612-f9917ea2cecd --resource-group $RESOURCE_GROUP --vault-name $FILE_BACKUP_VAULT |
...