简体   繁体   中英

run azure cli against a specific storage account

I am trying to run the following az storage cli command to add CORS settings:

az storage cors --account-name mystorage --origins '*' --methods GET,POST,PUT --allowed-headers 'Accept-Ranges,Content-Encoding,Content-Length,Content-Type,Range,Authorization,x-ms-blob-content-type,x-ms-blob-type,x-ms-version' --exposed-headers 'Accept-Ranges,Content-Range,Content-Encoding,Content-Length,Content-Type' --max-age 86400 --services blob

BUt I get the following error:

az storage cors: 'mystorage' is not in the 'az storage cors' command group. See 'az storage cors --help'.

You forgot to include operation type ( add in this case). Please try the following:

az storage cors add --account-name my storage --origins '*' --methods GET POST PUT --allowed-headers 'Accept-Ranges,Content-Encoding,Content-Length,Content-Type,Range,Authorization,x-ms-blob-content-type,x-ms-blob-type,x-ms-version' --exposed-headers 'Accept-Ranges,Content-Range,Content-Encoding,Content-Length,Content-Type' --max-age 86400 --services b

Two more things I noticed in your command:

  1. Methods should be space separated and not comma separated. So it should be --methods GET POST PUT instead of method GET,POST,PUT .
  2. Service should be "b" for blob.

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