diff options
author | mail_redacted_for_web | 2025-07-24 14:49:27 +0200 |
---|---|---|
committer | mail_redacted_for_web | 2025-07-24 14:49:27 +0200 |
commit | 1b082205f1e98a084695b042adec5cc122ff7717 (patch) | |
tree | ddfc10de4f5a9f7b6732ae98d6d52cf72769f58e /AzureHelpers/Public/List-AzVms.ps1 | |
download | azure-helpers-1b082205f1e98a084695b042adec5cc122ff7717.tar.bz2 |
InComm, rather spontaneous
Diffstat (limited to 'AzureHelpers/Public/List-AzVms.ps1')
-rw-r--r-- | AzureHelpers/Public/List-AzVms.ps1 | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/AzureHelpers/Public/List-AzVms.ps1 b/AzureHelpers/Public/List-AzVms.ps1 new file mode 100644 index 0000000..8c88a63 --- /dev/null +++ b/AzureHelpers/Public/List-AzVms.ps1 @@ -0,0 +1,25 @@ +function List-AzVms { + <# + .SYNOPSIS + List all VMs inside the Azure subscription we are logged into. + + .DESCRIPTION + This simply uses `az vm list` with a few parameters. Main purpose: coloured + and terse output. + + .INPUTS + None. (Also, no parameters.) + + .OUTPUTS + String. A coloured JSON output showing a more or less terse list of VMs. + #> + [Alias( + 'azvmlist', + 'azvml' + )] + # PowerShell will throw an exception "Unexpected attribute 'Alias'." if you don't define Param() below. If you do, everything is fine. + # POWERSHELL IS SO SOPHISTICATED AND GOOD, the number of times I've heard this bollocks definitely equals the quality + Param( + ) + az vm list -o jsonc --query '[].{name: name,resourceGroup: resourceGroup,tenantId: identity.tenantId,principalId: identity.principalId}' +}
\ No newline at end of file |