Skip to content

Instantly share code, notes, and snippets.

@irwinwilliams
Last active August 24, 2016 06:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irwinwilliams/4cf93b6e2461c753ff125590650186ae to your computer and use it in GitHub Desktop.
Save irwinwilliams/4cf93b6e2461c753ff125590650186ae to your computer and use it in GitHub Desktop.
Update an Azure Blob's CORS setting
#works with Azure in Powershell v 1.3.2
clear
$StorageAccountName = "[storageaccountname]"
$Key = "[storageaccountkey]"
$Context = New-AzureStorageContext -StorageAccountKey $Key -StorageAccountName $StorageAccountName
$CorsRules = (@{
AllowedHeaders=@("*");
AllowedOrigins=@("*");
ExposedHeaders=@("content-length");
MaxAgeInSeconds=200;
AllowedMethods=@("Get","Connect", "Head")})
Set-AzureStorageCORSRule -ServiceType Blob -CorsRules $CorsRules -Context $Context
$CORSrule = Get-AzureStorageCORSRule -ServiceType Blob -Context $Context
echo "Current CORS rules: "
echo $CORSrule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment