Wednesday, October 7, 2015

Configuring Storage Metrics and Retention using PowerShell Commands


  • Azure Storage has in-built analytics feature called Azure Storage Analytics used for collecting metrics and logging storage request activity. 
  • You enable Storage Analytics Metrics to collect aggregate transactions and capacity data and you enable Storage Analytics Logging to capture Successful and Failed request attempts to your Storage Account.


There are 2 levels of metrics collections:
  1. Service Level: These metrics include aggregate statistics for all requests, aggregated at a specific interval.
  2. API Level: These metrics record every request to each service only if a request is made within the hour interval


a. To enable Service level metrics collected by minute for blobs, tables and queues with unlimited retention

Set-AzureStorageServiceMetricsProperty -MetricsType Minutes
                                       -ServiceType Blob
                                       -MetricsLevel Service
                                       -RetentionDays 0

Set-AzureStorageServiceMetricsProperty -MetricsType Minutes
                                       -ServiceType Table
                                       -MetricsLevel Service
                                       -RetentionDays 0

Set-AzureStorageServiceMetricsProperty -MetricsType Minutes
                                       -ServiceType Queue
                                       -MetricsLevel Service
                                       -RetentionDays 0

b.To enable Service and API level metrics collected by Hour for blobs, tables and queues with 90 days of retention period

Set-AzureStorageServiceMetricsProperty -MetricsType Hour
                                       -ServiceType Blob
                                       -MetricsLevel ServiceAndApi
                                       -RetentionDays 90

Set-AzureStorageServiceMetricsProperty -MetricsType Hour
                                       -ServiceType Table
                                       -MetricsLevel ServiceAndApi
                                       -RetentionDays 90

Set-AzureStorageServiceMetricsProperty -MetricsType Hour
                                       -ServiceType Queue
                                       -MetricsLevel ServiceAndApi
                                       -RetentionDays 90
C. To Disable the collection of metrics

Set-AzureStorageServiceMetricsProperty -ServiceType Blob
                                       -MetricsLevel None


Set-AzureStorageServiceMetricsProperty -ServiceType Table
                                       -MetricsLevel None


Set-AzureStorageServiceMetricsProperty -ServiceType Queue
                                       -MetricsLevel None




No comments:

Post a Comment