You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 27, 2020. It is now read-only.
This would actually not be that hard to do. There are two delete scenarios:
Delete a blob when the related item is deleted.
Delete a blob and keep the related item.
Both scenarios can use the same shared function code, which in the first scenario gets called in the delete operation script and the second scenario would require a custom API to delete just the blob. Neither scenario requires an SAS because the delete is done by the service, which has the access keys safely stored in app settings.
The delete code might look something like this:
var azure = require('azure');
var appSettings = require('mobileservice-config').appSettings;
function deleteBlob (item){
// Get storage account settings from app settings.
var accountName = appSettings.STORAGE_ACCOUNT_NAME;
var accountKey = appSettings.STORAGE_ACCOUNT_ACCESS_KEY;
var host = accountName + '.blob.core.windows.net';
var blobService = azure.createBlobService(accountName, accountKey, host);
blobService.deleteBlob(item.containerName, item.resourceName, null, function(error){
// do error handling here.
})
}
NOTE: This is not tested or fully functional code, so please be warned.