What is SAS? it is shared access signatures. You can use a shared access signature (SAS) to delegate access to resources in your Azure Storage account. A SAS token includes the targeted resource, the permissions granted, and the interval over which access is permitted. Best practices recommend that you limit the interval for a SAS in case it is compromised. By setting a SAS expiration policy for your storage accounts, you can provide a recommended upper expiration limit when a user creates a service SAS or an account SAS.

The token is returned in Get storage by ID call that shows sensitive data (/storages/:id?include_sensitive=true). We're interested in its se= parameter which shows the expiration time.

Suppose that, you need to check whether the SAS token is expired or not, you can do it following as below

First, using Python code

from urllib.parse import parse_qs
from datetime import datetime
import argparse
import sys

parser = argparse.ArgumentParser(description='Azure SAS token parser')
parser.add_argument("--token", dest='token', required=True)
parser.add_argument("--get-exp-date", dest="get_exp_date", action='store_true')
parser.add_argument("--get-exp-date-as-ts", dest="get_exp_date_as_ts", action='store_true')
parser.add_argument("--se-parameter-format", dest="se_param_fmt")

args = parser.parse_args()
TOKEN = args.token
SE_PARAM_FMT = args.se_param_fmt
GET_EXP_DATE = args.get_exp_date
GET_EXP_DATE_AS_TS = args.get_exp_date_as_ts

INPUT_FMT = SE_PARAM_FMT if SE_PARAM_FMT else "%Y-%m-%dT%H:%M:%SZ"
OUTPUT_FMT = "%Y-%m-%d %H:%M:%S"

parsed = parse_qs(TOKEN.lstrip("?"))
se = parsed.get("se")

if not se:
    print("'se' parameter not found in SAS token. Make sure the token is valid", file=sys.stderr)
    sys.exit(1)

try:
    se_dt = datetime.strptime(se[0], INPUT_FMT)
except ValueError as e:
    print(e, "\nPlease use --se-parameter-format to set 'se' parameter formatting")
    sys.exit(1)

se_date = se_dt.strftime(OUTPUT_FMT)
se_ts = int(se_dt.timestamp())

if GET_EXP_DATE and not GET_EXP_DATE_AS_TS:
    print(se_date)
    sys.exit(0)

elif GET_EXP_DATE and GET_EXP_DATE_AS_TS:
    print("{}\n{}".format(se_date, se_ts))
    sys.exit(0)

elif not GET_EXP_DATE and GET_EXP_DATE_AS_TS:
    print(se_ts)
    sys.exit(0)

else:
    parser.print_help(sys.stderr)
    sys.exit(1)

Run the command:

python3 filename.py --token "?sv= ....%3D" --get-exp-date