Accessing Azure
Our goal in this section is to describe how PowerShell can be used to connect a query with a resource within Azure.
Install and import the Azure PowerShell module
Before diving into reconnaissance, installing and importing the Azure PowerShell module is essential. This module provides cmdlets designed explicitly for interacting with Azure resources:
Install-Module -Name Az -Force -AllowClobber -Scope CurrentUser Import-Module Az
Authenticate and connect to Azure
Authenticate and connect to your Azure subscription to access the resources within the environment:
PS C:\> $Creds = Get-Credential PS C:\> Connect-AzAccount -Credential $Creds Account SubscriptionName TennantID Environment ------- ---------------- ------------------------------------ ----------- ajcblyth@snowcapcyber.com Infinity 749a36a1-402a-481c-a0c0-66f677504ea8 AzureCloud
Once we have connected to an Azure Tenancy, we can query it to ensure it is correct:
PS C:\> Get-AzTenant Id Name Category Domains -- ---- -------- ------- 749a36a1-402a-481c-a0c0-66f677504ea8 SnowCap Cyber Home {snowcapcyber.onmicrosoft.com, snowcapcyber.com}