Cloud Pen-testing Part-1

## Microsoft Azure & O365 CLI Tool Cheatsheet

### Az PowerShell Module

Import-Module Az

### Authentication

Connect to Azure with account credentials

```powershell
Connect-AzAccount

Alternatively, if MFA restrictions are in place

$credential = Get-Credential
Connect-AzAccount -Credential $credential

Import a context file

Import-AzContext -Profile 'C:\Temp\Live Tokens\StolenToken.json'

Export a context file

Save-AzContext -Path C:\Temp\AzureAccessToken.json

Account Information

List the current Azure contexts available

Get context details

List subscriptions

Choose a subscription

Get the current user's role assignment

List all resources and resource groups

List storage accounts

WebApps & SQL

List Azure web applications

List SQL servers

Individual databases can be listed with information retrieved from the previous command

List SQL Firewall rules

List SQL Server AD Admins

Runbooks

List Azure Runbooks

Export a runbook

Last updated

Was this helpful?