olegarr on Mon, 11 May 2020 00:45:46
BhargaviAnnadevara-MSFT on Mon, 11 May 2020 05:17:08
Seems like there is no straightforward way of getting the Usage of the File share using the Get-AzRmStorageShare cmdlet.
However, you can use the Get-AzMetric cmdlet to fetch the same as follows:
(Get-AzMetric -ResourceId "<resourceID>" -MetricName "FileCapacity" -AggregationType "Average").Data
You should get a response in the following format (in bytes):
TimeStamp : 5/11/2020 3:36:00 AM Average : 5368709941 Minimum : Maximum : Total : Count :
Hope this helps!
olegarr on Wed, 13 May 2020 14:40:53
Thanks a lot for your help!
I tried to run the command
(Get-AzMetric -ResourceId "/subscriptions/XXXXX-XXXX/resourceGroups/XYZ/providers/Microsoft.Storage/storageAccounts/StorageAcctName/fileServices/default/shares/FileShareName" -MetricName "FileCapacity" -AggregationType "Average").Data
and got the following error:
Get-AzMetric : Exception type:
ErrorResponseException, Message: Microsoft.Azure.Mana
Operation returned an invalid status code
Is it fixable?
Thanks a lot!
BhargaviAnnadevara-MSFT on Wed, 13 May 2020 15:43:22
You almost got it!
Please have the ResourceId in the following format:
The rest should work then. Please try and let me know in case of issues.
olegarr on Wed, 13 May 2020 16:29:32
Yes, it worked.
Thank you very much for your help!
BhargaviAnnadevara-MSFT on Wed, 13 May 2020 16:30:48
Awesome, glad I could help! :)