I would like to store files in Azure Blob Storage. So far so good. I also would like to store addtional meta-data about the file; for that I use a Azure SQL Database (so I c
The blob existing is harmless, but a database record that points to a blob that doesn't exist would be bad. Therefore, I'd implement the transaction with the following logic.
On create... add the blob first, then create the database record. If blob upload fails, just return. If blob upload succeeds, but database record fails, delete the blob and return. The point is you wouldn't want to create a database record until AFTER a successful blob upload. You also want to clean up the blob if the database record couldn't be updated. If blob cleanup fails, I'd just have a service that runs periodically to clean up unreferenced blobs created more than an hour earlier just so it doesn't try to delete one between upload and creation of the database record.
On removal... Delete the database record first. If that fails, just return, the blob and database record are both still there. If the database record is deleted ok, the blob isn't hurting anything by remaining there, so you can either try to delete it immediately or leave it for a cleanup service to take care of later.