简体   繁体   中英

How to set CORS for Azure Blob Service for Premium Storage Account in the Azure Portal?

I created a Premium Azure Blob Storage account, created a Shared Access Signature and tried to upload an image from a asp.net core web application html page that runs under http://localhost:5001 .

I don't see a CORS section in the portal. So, I set All Networks under Firewalls and virtual networks which I think should allow http://localhost:5001 .

I get the following error when I try to post to the Blob account:

Access to XMLHttpRequest at 'https://mypictures.blob.core.windows.net/<Token>' from origin 'https://localhost:5001' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

The reason you're getting this error is because CORS is not configured for the blob service for your storage account. The reason you don't see the option to configure CORS in Azure Portal is because CORS is not supported for Premium Storage Accounts .

From this link :

在此处输入图片说明

You will need to upload a file in a premium storage account using other ways like AzCopy , Azure PowerShell , Azure CLI , any storage explorer or write code yourself using any available SDK.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM