Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Set the CORS rules on an Azure Storage account to allow two domains, GET / POST, and cache for one hour
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure.Storage.Shared.Protocol;
public void SetCorsRules() {
var rule = new CorsRule
AllowedMethods = CorsHttpMethods.Get | CorsHttpMethods.Post,
AllowedOrigins = new List<string>
MaxAgeInSeconds = 3600
var account = CloudStorageAccount.Parse("YourStorageConnectionString");
var client = account.CreateCloudBlobClient();
var properties = client.GetServiceProperties();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment