Hi Chris Popescu ,
Greetings & Welcome to Microsoft Q&A forum! Thanks for posting your query!
Adding more information to the above response!
To monitor new and existing connections to your storage accounts and determine if they are still in use, you can use Azure's built-in monitoring and logging tools.
1.Enable Diagnostic Logs, Azure Storage accounts can generate diagnostic logs that provide detailed information about requests to the storage account. You can configure these logs to be sent to a Log Analytics workspace, archived to a storage account, or streamed to an event hub.
Steps:
- Navigate to your storage account in the Azure portal.
- Select
Diagnostic settings
under the Monitoring
section.
- Add a diagnostic setting and choose the types of logs you want to collect (e.g.,
Blob
, Table
, Queue
, File
).
- Select the destination for the logs (Log Analytics, storage account, or event hub).
2. Use Log Analytics to Query Logs , once you have enabled diagnostic logs and sent them to a Log Analytics workspace, you can use KQL to query the logs and identify active connections.
Example KQL Query:
AzureDiagnostics
| where ResourceType == "STORAGEACCOUNTS"
| where TimeGenerated > ago(31d)
| summarize count() by CallerIPAddress, OperationName
| order by count_ desc
This query will show you the IP addresses and operations that have accessed the storage account in the last 31 days.
3. Set Up Alerts, you can set up alerts based on the logs to notify you of any new or active connections.
Steps:
- Navigate to your Log Analytics workspace in the Azure portal.
- Select
Alerts
under the Monitoring
section.
- Create a new alert rule and define the conditions based on your KQL queries.
- Set up action groups to notify you via email, SMS, or other methods.
4. Use Network Security Group Flow Logs, if your storage account is accessed via a virtual network, you can use NSG flow logs to monitor network traffic.
Steps:
- Navigate to your Network Security Group in the Azure portal.
- Select
NSG flow logs
under the Monitoring
section.
- Enable flow logs and send them to a storage account or Log Analytics workspace.
By enabling diagnostic logs, using Log Analytics for querying, setting up alerts, and utilizing NSG flow logs, you can effectively monitor new and existing connections to your storage accounts. This will help you determine if they are still in use and can be safely deleted after a period of inactivity.
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.
If you have any other questions or are still running into more issues, let me know in the "comments" and I would be happy to help you.