Rails: How I can upload filie with Azure CDN ?

Long Nguyen 21 Reputation points
2022-08-23T05:09:42.91+00:00

I have an issue when uploading file with Azure CDN config. It throws BlobTypeNotSupported (400): Block blobs are not supported. I try research but I can't resolve it.
Anything help me, pls? Thanks, It is my code when uploading file.

 def upload_file(access_key, account_name, endpoint_protocol, file,container)  
        client = Azure::Storage::Blob::BlobService.create(  
          default_endpoints_protocol: endpoint_protocol,  
          storage_account_name: account_name,  
          storage_access_key: access_key  
        )  
        content = file.read  
        client.create_block_blob(container, file, content)  
 end  
Azure Content Delivery Network
0 comments No comments
{count} votes

Accepted answer
  1. SaiKishor-MSFT 17,201 Reputation points
    2022-08-24T06:56:59.163+00:00

    @Long Nguyen Thanks for reaching out to Microsoft Q&A. I understand that you are having issues with uploading file with Azure CDN where it throws error- BlobTypeNotSupported (400): Block blobs are not supported.

    As seen from a similar issue here- https://github.com/Azure/azure-cli/issues/977

    If you are using a Premium Page Blob and trying to upload a block blob, you will see this error. Please use a Premium Block Blob type storage account if you want to rather upload Block Blobs or a standard general purpose v2 account. Please refer to the different types of storage accounts here- https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview#types-of-storage-accounts

    Hope this helps. Please let us know if you have any more questions and we will be glad to assist you further. Thank you!

    Remember:

    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.

    Want a reminder to come back and check responses? Here is how to subscribe to a notification.


0 additional answers

Sort by: Most helpful