1) You can configure an Azure retention policy to move files from cool/hot tiers to archive tier based on the last accessed time attribute of a blob by using lifecycle management policies. Read here for examples. Below a policy example:
{
"enabled": true,
"name": "last-accessed-thirty-days-ago",
"type": "Lifecycle",
"definition": {
"actions": {
"baseBlob": {
"enableAutoTierToHotFromCool": true,
"tierToCool": {
"daysAfterLastAccessTimeGreaterThan": 30
}
}
},
"filters": {
"blobTypes": [
"blockBlob"
],
"prefixMatch": [
"mylifecyclecontainer/log"
]
}
}
}
Second question, you can apply filters to policies as shown here.
Third question, I personally save weekly backups of Azure SQL databases to Azure Storage Accounts as the retention period of automated backups is just 35 days. You can also consider using Azure Backups Long-Term Retention.
Fourth question, you can import a bacpac using Azure portal, sqlpackage tool and PowerShell as explained here, but you cannot make the import to replace an existing SQL Azure database. You will have to automate the drop of the database and then import from bacpac using the desired name for the database (the name of the database previously dropped).
$importRequest = New-AzSqlDatabaseImport -ResourceGroupName "<resourceGroupName>" `
-ServerName "<serverName>" -DatabaseName "<databaseName>" `
-DatabaseMaxSizeBytes "<databaseSizeInBytes>" -StorageKeyType "StorageAccessKey" `
-StorageKey $(Get-AzStorageAccountKey `
-ResourceGroupName "<resourceGroupName>" -StorageAccountName "<storageAccountName>").Value[0] `
-StorageUri "https://myStorageAccount.blob.core.windows.net/importsample/sample.bacpac" `
-Edition "Standard" -ServiceObjectiveName "P6" `
-AdministratorLogin "<userId>" `
-AdministratorLoginPassword $(ConvertTo-SecureString -String "<password>" -AsPlainText -Force)