Azure CLI存储集cors - 意外令牌

时间:2016-04-05 16:37:31

标签: azure cors azure-storage azure-cli

我尝试按照here设置CORS,但有错误:

$ azure storage cors set --blob static --cors [{\"AllowedOrigins\":\"*\",\"AllowedMethods\":\"GET\"}]
info:    Executing command storage cors set
+ Setting storage CORS rules for service: blob                                 
error:   Unexpected token :

[{\"AllowedOrigins\":\"*\",\"AllowedMethods\":\"GET\"}]有什么问题?

1 个答案:

答案 0 :(得分:3)

我相信你错过了MaxAgeInSeconds参数。如果我尝试没有这个参数,我会收到一个错误。但以下情况对我有用:

azure storage cors set --blob static 
--cors "[{\"AllowedOrigins\":\"*\",\"AllowedMethods\":\"GET\",\"MaxAgeInSeconds\":\"86400\",\"AllowedHeaders\":\"*\",\"ExposedHeaders\":\"*\"}]"
-a "account-name" -k "account-key" --verbose