Cloud Pen-testing Part-2

## Microsoft Azure & O365 CLI Tool Cheatsheet (Part - 2)

### Virtual Machines

#### List VMs and get OS details

```powershell
Get-AzVM
$vm = Get-AzVM -Name "VM Name"
$vm.OSProfile

Run commands on VMs

Invoke-AzVMRunCommand -ResourceGroupName $ResourceGroupName -VMName $VMName -CommandId RunPowerShellScript -ScriptPath ./powershell-script.ps1

Networking

List virtual networks

Get-AzVirtualNetwork

List public IP addresses assigned to virtual NICs

Get-AzPublicIpAddress

Get Azure ExpressRoute (VPN) Info

Get-AzExpressRouteCircuit

Get Azure VPN Info

Backdoors

Create a new Azure service principal as a backdoor

MSOnline PowerShell Module

Authentication

Account and Directory Information

List Company Information

List all users

List all groups

List members of a group (Global Admins in this case)

List all user attributes

List Service Principals

Az CLI Tool

Authentication

Dump Azure Key Vaults

List out any key vault resources the current account can view

With contributor level access, you can give yourself the right permissions to obtain secrets.

Get URI for Key Vault

Get cleartext secret from key vault

Metadata Service URL

Get access tokens from the metadata service

Other Azure & O365 Tools

MicroBurst

Azure security assessment tool

https://github.com/NetSPI/MicroBurst

Last updated

Was this helpful?