Azure CLI storage set cors - Unexpected token

[亡魂溺海] 提交于 2019-12-12 17:17:14

问题


I'm trying set CORS as mentioned here but have an error:

$ 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 :

What's wrong with [{\"AllowedOrigins\":\"*\",\"AllowedMethods\":\"GET\"}]?


回答1:


I believe you're missing MaxAgeInSeconds parameter. If I try without this parameter, I get an error. However the following worked for me:

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


来源:https://stackoverflow.com/questions/36432222/azure-cli-storage-set-cors-unexpected-token

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!