olahallengren / sql-server-maintenance-solution

SQL Server Maintenance Solution
https://ola.hallengren.com
MIT License
2.91k stars 755 forks source link

BackupType - Option to use lower case in URL #726

Open Kevin-S-Lewis opened 1 year ago

Kevin-S-Lewis commented 1 year ago

Given that Azure blob container names have to be lower case, and that the BackupType variable is in upper case of FULL/DIFF/LOG, when you may have different retention periods for Full's, Diff's and Log backups, then it would be useful to have separate containers with those different retention periods to automatically clear out files.

As such would it be possible to override the BackupType name or have an option of a @BackupTypeToLowerCase variable or even a @BackupPathToLowerCase?

Thus when using @DirectoryStructure and @AvailabilityGroupDirectoryStructure ending up something like this:

mybackups.blob.core.windows.net/full/{ServerName}${InstanceName}{DirectorySeparator}{DatabaseName} mybackups.blob.core.windows.net/full/{ClusterName}${AvailabilityGroupName}{DirectorySeparator}{DatabaseName}

mybackups.blob.core.windows.net/log/{ServerName}${InstanceName}{DirectorySeparator}{DatabaseName} mybackups.blob.core.windows.net/log/{ClusterName}${AvailabilityGroupName}{DirectorySeparator}{DatabaseName}

..and yes the method that the person running with this idea would either need 3 separate SAS keys/credentials or a SAS key generated off of the storage account with corresponding credential, which would then allow for @ChangeBackupType to be used.

https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#container-names

olahallengren commented 2 days ago

I have been doing some work on this. Please have a look at https://github.com/olahallengren/sql-server-maintenance-solution/pull/836.