Azure VM Details
I was looking for a way to have a list with Azure VM Details of Azure Classic deployment. Some of the details are VM Name, HostName, Service Name, IP address, Instance Size, Availability Set, Operating System, Disk Name (OS), SourceImageName (OS), MediaLink (OS), HostCaching (OS), Subnet, DataDisk Name, DataDisk HostCaching, DataDisk MediaLink, DataDisk Size.
Lets start. The first step wat to open PowerShell ISE, search some technet articles and after a lot of test I created the below script.
Add-AzureAccount Select-AzureSubscription -SubscriptionId xxxxxxx-xxxxxxxx-xxxxxx-xxxxxx $VMlist = ForEach ($VM in (Get-AzureVM)) { Get-AzureOSDisk -VM $VM | Select @{Label="VM";Expression={$VM.Name}},` @{Label="HostName";Expression={$VM.HostName}},` @{Label="Service";Expression={$VM.ServiceName}},` @{Label="IP";Expression={$VM.IpAddress}},` @{Label="InstanceSize";Expression={$VM.InstanceSize}},` @{Label="AvailabilitySet";Expression={$VM.AvailabilitySetName}},` OS,DiskName,SourceImageName,MediaLink,HostCaching, ` @{Label="Subnet";Expression={(Get-AzureSubnet -VM $VM)}},` @{Label="DataDiskName";Expression={(Get-AzureDataDisk -VM $VM).DiskName}},` @{Label="DDHostCaching";Expression={(Get-AzureDataDisk -VM $VM).HostCaching}},` @{Label="DDMediaLink";Expression={(Get-AzureDataDisk -VM $VM).MediaLink}},` @{Label="DDSize";Expression={(Get-AzureDataDisk -VM $VM).LogicalDiskSizeInGB}} } $VMlist | Sort VM,SourceImageName | Export-CSV C:\vms_alldata.csv -NoTypeInformation
Next, just open the vms_alldata.csv with Excel, convert test to columns and insert table and voila:
Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.