azure-storage-blobs

Retention Policy for Azure Containers?

喜夏-厌秋 提交于 2019-12-07 10:16:53
问题 I'm looking to set up a policy for one of my containers so it deletes or only retains data for x days. So if x is 30, that container should only contain files that are less than 30 days old. If the files are sitting in the container for more than 30 days it should discard them. Is there any way I can configure that? 回答1: Currently such kind of thing is not supported by Azure Blob Storage. You would need to write something of your own that would run periodically to do this check and delete old

Python Azure SDK: Using list_blobs to get more than 5.000 Results

倖福魔咒の 提交于 2019-12-07 05:48:49
问题 I'm having trouble with the Python Azure SDK and haven't found anything both on Stack Overflow and in the Msdn Forums. I want to use Azure SDKs list_blobs() to get a list of blobs - there are more than 5.000 (which is the max_result). If I take a look at the code in the SDK itself then I see the following: def list_blobs(self, container_name, prefix=None, marker=None, maxresults=None, include=None, delimiter=None): The description for 'Marker' being: marker: Optional. A string value that

Azure function version 2.0 - app blobTrigger not working

杀马特。学长 韩版系。学妹 提交于 2019-12-07 05:32:02
问题 I had a working Function App that got a blob input and an event hub output (worked in beta). With latest changes, my function no longer works. I've tried to update the host.json file according to the release note, but it has not reference to blob trigger: { "version": "2.0", "extensions": { "blobTriggers" : { "name": "blob", "type": "blobTrigger", "direction": "in", "path": "iot3gblobs/{name}", "connection": "AzureWebJobsStorage" }, "eventHubs": { "type": "eventHub", "name":

Uploading to azure blob storage from SAS URL returns 404 status

非 Y 不嫁゛ 提交于 2019-12-07 03:56:26
I am using Azure Mobile Services API endpoint to return a private shared access signature URL to my azure storage container like so: var blobService = azure.createBlobService(accountName, key, host); blobService.createContainerIfNotExists(containerName, function(err) { if (err) { cb(err, null); return; } // Generate a 5 minute access var expiryDate = minutesFromNow(5); var sharedAccessPolicy = { AccessPolicy: { Permissions: azure.Constants.BlobConstants.SharedAccessPermissions.WRITE, Expiry: expiryDate } }; // Generate the URL with read access token var sasURL = blobService

AddAttachment from MemoryStream

和自甴很熟 提交于 2019-12-07 03:53:58
问题 The SendGrid API docs specify you can add attachments from a Stream. The example it gives uses a FileStream object. I have some blobs in Azure Storage which I'd like to email as attachments. To achieve this I'm trying to use a MemoryStream : var getBlob = blobContainer.GetBlobReferenceFromServer(fileUploadLink.Name); if(getBlob != null) { // Get file as a stream MemoryStream memoryStream = new MemoryStream(); getBlob.DownloadToStream(memoryStream); emailMessage.AddAttachment(memoryStream,

Configure CORS by using Azure Resource Manager template

為{幸葍}努か 提交于 2019-12-07 03:29:11
问题 I'm trying to set CORS rule for my storage account as suggested here under Configure CORS by using Azure Resource Manager tools: https://docs.microsoft.com/en-us/azure/app-service-api/app-service-api-cors-consume-javascript by adding property cors: "resources": [ { "type": "Microsoft.Storage/storageAccounts", "sku": { "name": "Standard_RAGRS", "tier": "Standard" }, "kind": "Storage", "name": "[parameters('storageAccounts_teststoragejkjk_name')]", "apiVersion": "2016-01-01", "location":

Getting a StorageException (403: Forbidden) on CloudStorageContainer GetContainerReference method

旧巷老猫 提交于 2019-12-07 02:22:32
问题 I'm running the following code in a unit test against Azure's Storage Emulator and receiving a StorageException when I attempt to create the container: var connectionString = @"DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="; var account = CloudStorageAccount.Parse(connectionString); var client = account.CreateCloudBlobClient(); var container = client.GetContainerReference("my

Increase Azure blob block upload limit from 32 MB

我是研究僧i 提交于 2019-12-07 01:58:29
I am trying to upload a contents to azure blob and the size is over 32MB. The c# code snippet below: CloudBlockBlob blob = _blobContainer.GetBlockBlobReference(blobName); blob.UploadFromByteArray(contents, 0, contents.Length, AccessCondition.GenerateIfNotExistsCondition(), options:writeOptions); Everytime the blob is over 32MB, the above raises an exception: Exception thrown: 'Microsoft.WindowsAzure.Storage.StorageException' in Microsoft.WindowsAzure.Storage.dll Additional information: The remote server returned an error: (404) Not Found. As per this When a block blob upload is larger than the

how to revoke Shared Access Signature in Azure SDK

久未见 提交于 2019-12-06 23:52:17
问题 I could not find any code sample for revoking the created Shared Access Signature access on blob, can anyone provide me link or reference for removing the Shared Access Signature access created earlier. 回答1: You can't revoke a shared access signature unless it is based on a stored access policy. See http://msdn.microsoft.com/en-us/library/azure/dn140257.aspx for more information: To revoke a stored access policy, you can either delete it, or rename it by changing the signed identifier.

CloudBlob not found in the new Microsoft.WindowsAzure.Storage what is its equivalent

左心房为你撑大大i 提交于 2019-12-06 15:06:56
I had the following code which was using the deprecated Microsoft.WindowsAzure.StorageClient and have upgraded to Microsoft.WindowsAzure.Storage and now I am unable to use the code below as it is not recognising the CloudBlob class, has this been totally removed or is there an equivalent class I can use in a similar manner //blob client now CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); //the container for this is customerlogo CloudBlobContainer container = blobClient.GetContainerReference(Container); container.SetPermissions(new BlobContainerPermissions { PublicAccess =