I am searching for command in powershell or Azure cli which shows me the total size of use a storage account, how many disks attached in virtual machine and version of SQL installed in VM.

It is possible to concatenate with Get-AzureRmStorageAccount cmdlets | Get-AzureRmVM to show results?

I will appreciate any reply.

Leonardo Almeida

  • Do you have to do this in one line? Seems a bit of an odd approach. What is it you are trying to achieve out of the end of this? – Sam Cogan Jul 14 '18 at 12:12
  • get-help will show you if the cmdlet will accept input via pipeline and what objects they produce and accept as input. – Davidw Jul 15 '18 at 3:04

As you can concatenate just about anything, I am sure you could if you really wanted to but it would be completely un-readable.

You will need to write a script to perform the actions you need.

To Get you started; I have provided links to some scripts / some code snippets:

To get the billable size of a storage account:

To get the number of data disks attached to a vm:
$datadisks = (Get-AzureRmVM -ResourceGroupName rg-name -Name vmName).DataDisks.count

Sql Version on a Machine:

  • Hello Lachie, Eatiu looking for a more automated script where you do not need to enter the names of the resource group and storage account to know the total size in GB or TB and whether the storage is in Standard or Premium. Thanks for answering – Leonardo Fogaça de Almeida Jul 17 '18 at 21:04
  • No worries again that can be done but you will need to start writing it yourself, this is not a forum for people to write scripts for you. – Lachie White Jul 17 '18 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.