When variables are used from Variable Groups, it is not easy to use template expressions or even macro expressions.
You can try the bellow:
-job:MyJob
variables:
myEscapedSecret: $[replace(replace(variables['STORAGEACCOUNTKEYDBASEBK'], '\', '\\'), '"', '\"')]
steps:
-task: xxxxxx
--storage-key "$(myEscapedSecret)"