Search code examples
azureazure-blob-storageazure-cliazure-sasshared-access-signatures

How to create SAS token for azure blob storage container with f permissions


These docs refer to needing f SAS permissions to do filter operations. How can I generate a SAS token with these permissions? I can't do it from the web interface and the az tool doesn't consider f a valid --permissions flag.

In the end I want to be able to use the rest API using curl to fiddle with the find by tags feature.


Solution

  • According to Az CLI documentation, f is a valid permission:

    --permissions: The permissions the SAS grants. Allowed values: (a)dd (c)reate (d)elete (e)xecute (f)ilter_by_tags (i)set_immutability_policy (l)ist (m)ove (r)ead (t)ag (w)rite (x)delete_previous_version (y)permanent_delete. Do not use if a stored access policy is referenced with --id that specifies this value. Can be combined.

    You should probably upgrade your CLI version (I'm using v2.38.0):

    az upgrade
    

    I was able to generate a SAS using this command:

    az storage container generate-sas `
      --name "<container-name>" `
      --account-name <account-name> `
      --auth-mode login --as-user `
      --permissions f --expiry 2022-08-01