Storage SAS tokens should adhere to 7 day maximum validity
Facts read 10 Nov 2026. Page reviewed 16 Nov 2026.
Storage SAS tokens should adhere to 7 day maximum validity is an Azure guardrail written in Azure Policy. Denies storage accounts whose SAS expiration policy allows tokens valid for more than 7 days, which limits how long a leaked token can move data out.
More data exfiltration guardrails ยท About Azure Policy
Built-in policy definition: Storage SAS tokens should adhere to 7 day maximum validity
Definition ID: 7aa1c9d5-3d7e-4579-8117-d85e99211757
Category: Storage
Supported effects: Audit, Deny, Disabled
policyRule (copied from the repository file):
{
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"anyOf": [
{
"field": "Microsoft.Storage/storageAccounts/sasPolicy",
"exists": "false"
},
{
"field": "Microsoft.Storage/storageAccounts/sasPolicy.sasExpirationPeriod",
"exists": "false"
},
{
"value": "[if(empty(field('Microsoft.Storage/storageAccounts/sasPolicy.sasExpirationPeriod')), 99, int(split(field('Microsoft.Storage/storageAccounts/sasPolicy.sasExpirationPeriod'), createArray(':', '.'))[0]))]",
"greater": 7
},
{
"allOf": [
{
"value": "[if(empty(field('Microsoft.Storage/storageAccounts/sasPolicy.sasExpirationPeriod')), 0, int(split(field('Microsoft.Storage/storageAccounts/sasPolicy.sasExpirationPeriod'), createArray(':', '.'))[0]))]",
"equals": 7
},
{
"anyOf": [
{
"value": "[if(empty(field('Microsoft.Storage/storageAccounts/sasPolicy.sasExpirationPeriod')), 0, int(split(field('Microsoft.Storage/storageAccounts/sasPolicy.sasExpirationPeriod'), createArray(':', '.'))[1]))]",
"notEquals": 0
},
{
"value": "[if(empty(field('Microsoft.Storage/storageAccounts/sasPolicy.sasExpirationPeriod')), 0, int(split(field('Microsoft.Storage/storageAccounts/sasPolicy.sasExpirationPeriod'), createArray(':', '.'))[2]))]",
"notEquals": 0
},
{
"value": "[if(empty(field('Microsoft.Storage/storageAccounts/sasPolicy.sasExpirationPeriod')), 0, int(split(field('Microsoft.Storage/storageAccounts/sasPolicy.sasExpirationPeriod'), createArray(':', '.'))[3]))]",
"notEquals": 0
}
]
}
]
},
{
"field": "Microsoft.Storage/storageAccounts/sasPolicy.expirationAction",
"exists": "false"
},
{
"field": "Microsoft.Storage/storageAccounts/sasPolicy.expirationAction",
"notEquals": "Block"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
- Blocks
- Denies storage accounts whose SAS expiration policy allows tokens valid for more than 7 days, which limits how long a leaked token can move data out.
- Breaks
- Existing storage accounts with longer SAS lifetimes are marked non-compliant but not changed. (source)
- Test before applying
- As for every Azure Policy guardrail: how to test before enforcing
- Mechanism
- Azure Policy (built-in definitions): Resources at the scope of the assignment (management group, subscription, resource group) and their children, except notScopes and exemptions
- Taken from
- open source set, MIT License, Azure/azure-policy repository, https://raw.githubusercontent.com/Azure/azure-policy/master/LICENSE
What the source says
"This policy ensures that Shared Access Signature (SAS) tokens for storage accounts are configured with a maximum validity period of 7 days or less." (read 10 Nov 2026).
What it breaks is documented for every guardrail of this mechanism: see Azure Policy.
Related guardrails
- Deny AWS RAM sharing with external accountsAWS, Service control policies (SCPs), data exfiltration
- Block public sharing of EBS snapshots (declarative policy)AWS, Declarative policies, data exfiltration
- Domain restricted sharingGoogle Cloud, Organization Policy Service (managed and legacy constraints), data exfiltration
Related pages
Sources
- Storage SAS tokens should adhere to 7 day maximum validity, read 10 Nov 2026
- What it breaks, read 10 Nov 2026
- How to test it first, read 10 Nov 2026
Last reviewed 16 Nov 2026.