getting storage account File Share Count metric in File metric namespace using az cli

frigo 1 Reputation point
2025-04-24T07:39:58.5066667+00:00

I would like to use the az cli to retrieve the "File Share Count" metric from the "File" namespace of my storage account. This is available in the Azure portal, however I did not find a way to access this metric using the az cli:

az monitor metrics list-namespaces --resource /subscriptions/14../resourceGroups/nld11/providers/Microsoft.Storage/storageAccounts/..f4 -o table This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus Classification Metric Namespace Name


Platform microsoft.storage/storageaccounts

there is no "File" namespace and no metric matching a File Share Count.

Is there a way to retrieve the File Share Count metric value through the az cli?

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,400 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nandamuri Pranay Teja 1,765 Reputation points Microsoft External Staff
    2025-04-24T08:21:35.59+00:00

    Hello frigo,

    Thanks for your question!

    Use az monitor metrics list-definitions with the Microsoft.Storage/storageAccounts namespace and --metric-names FileShareCount to confirm the metric's existence. Post which Uses az monitor metrics list with the same namespace and --metric "FileShareCount" to retrieve the current value.

    Please be informed that While the File namespace doesn't directly expose a "File Share Count" metric, the Microsoft.Storage/storageAccounts namespace does contain this information. You can retrieve the definition of the FileShareCount metric using the following command:

    az monitor metrics list-definitions --resource /subscriptions/14../resourceGroups/nld11/providers/Microsoft.Storage/storageAccounts/..f4 --namespace Microsoft.Storage/storageAccounts --metric-names FileShareCount -o table
    

    After confirming the definition of the metric, you may obtain the current value by utilizing the az monitor metrics list command.

    az monitor metrics list --resource /subscriptions/14../resourceGroups/nld11/providers/Microsoft.Storage/storageAccounts/..f4 --namespace Microsoft.Storage/storageAccounts --metric "FileShareCount" -o table
    

    This command will output the current count of file shares within your specified storage account.

    Hope the above answer helps! Please let us know do you have any further queries.


    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. 

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.