审核 Azure 文件存储服务
Auditing Azure File Storage Service
据记载,存储分析日志记录当前不适用于文件存储服务。
Storage Analytics metrics are available for the Blob, Queue, Table, and File services.
Storage Analytics logging is available for the Blob, Queue, and Table services.
https://docs.microsoft.com/en-us/rest/api/storageservices/enabling-and-configuring-storage-analytics
知道这一点后,我希望可以通过指标确定文件服务的使用情况,但是我无法隔离某些我可以最终认为是文件使用情况的内容。容量似乎没有增加,入口/出口我无法隔离为仅用于文件。
如何最好地审核文件使用情况?
有一种解决方法可以让 metrics/analytics 获得存储服务,特别是 Azure 文件。到目前为止,它还不在存储分析中。 .net SDK 中有一个选项,允许您查看不同的指标。虽然,您必须使用资源 ID,这是通过 Azure Storage Metrics 完成的:
如果要列出 blob、table、file 或队列的指标定义,必须为每个指定不同的资源 ID API.
服务代码示例:
public static async Task ListStorageMetricDefinition()
{
// Resource ID for storage account
var resourceId = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{storageAccountName}";
var subscriptionId = "{SubscriptionID}";
// How to identify Tenant ID, Application ID and Access Key: https://azure.microsoft.com/documentation/articles/resource-group-create-service-principal-portal/
var tenantId = "{TenantID}";
var applicationId = "{ApplicationID}";
var accessKey = "{AccessKey}";
// Using metrics in Azure Monitor is currently free. However, if you use additional solutions ingesting metrics data, you may be billed by these solutions. For example, you are billed by Azure Storage if you archive metrics data to an Azure Storage account. Or you are billed by Operation Management Suite (OMS) if you stream metrics data to OMS for advanced analysis.
MonitorClient readOnlyClient = AuthenticateWithReadOnlyClient(tenantId, applicationId, accessKey, subscriptionId).Result;
IEnumerable<MetricDefinition> metricDefinitions = await readOnlyClient.MetricDefinitions.ListAsync(resourceUri: resourceId, cancellationToken: new CancellationToken());
foreach (var metricDefinition in metricDefinitions)
{
//Enumrate metric definition:
// Id
// ResourceId
// Name
// Unit
// MetricAvailabilities
// PrimaryAggregationType
// Dimensions
// IsDimensionRequired
}
}
来源:Azure Storage metrics in Azure Monitor
您也可以通过以下 Portal 进行操作: