Here's a simple script to export all VMs from Azure with the VM information to a CSV file:
$VMs = Get-AzVM
$VMs | Select-Object Name, ResourceGroupName, Location, VMId, PowerState, OSProfile | Export-Csv -Path "AzureVMsWithInfo.csv" -NoTypeInformation
Write-Host "All VMs with VM information exported to AzureVMsWithInfo.csv"
Note: You'll need to have the Azure PowerShell module installed and authenticated to your Azure account before running this script. The script will export the VM name, resource group name, location, VM ID, power state, and OS profile information for each VM.
No comments:
Post a Comment