Skip to content

Commit a4264a4

Browse files
authored
Merge pull request #188263 from tamram/tamram22-0210
add kusto log query for SasExpiryStatus
2 parents f1079b8 + a21d06e commit a4264a4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

articles/storage/common/sas-expiration-policy.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,19 @@ The SAS expiration period appears in the console output.
101101

102102
---
103103

104-
## Check for SAS expiration policy violations
104+
## Query logs for policy violations
105+
106+
To log the creation of a SAS that is valid over a longer interval than the SAS expiration policy recommends, first create a diagnostic setting that sends logs to an Azure Log Analytics workspace. For more information, see [Send logs to Azure Log Analytics](../blobs/monitor-blob-storage.md#send-logs-to-azure-log-analytics).
107+
108+
Next, use an Azure Monitor log query to monitor whether policy has been violated. Create a new query in your Log Analytics workspace, add the following query text, and press **Run**.
109+
110+
```kusto
111+
StorageBlobLogs
112+
| where SasExpiryStatus startswith "Policy violated"
113+
| summarize count() by AccountName, SasExpiryStatus
114+
```
115+
116+
## Use a built-in policy to monitor compliance
105117

106118
You can monitor your storage accounts with Azure Policy to ensure that storage accounts in your subscription have configured SAS expiration policies. Azure Storage provides a built-in policy for ensuring that accounts have this setting configured. For more information about the built-in policy, see **Storage accounts should have shared access signature (SAS) policies configured** in [List of built-in policy definitions](../../governance/policy/samples/built-in-policies.md#storage).
107119

0 commit comments

Comments
 (0)