Beginners Guide To Pentesting Azure
Beginners Guide To Pentesting Azure
Let us start by installing the Azure Active Directory PowerShell Modules.
Install-Module AzureAD
With the module installed we can now run the following from the command line to list all the available commands.
get-command -Module AzureAD
If we look down the list we can see a command for connecting to Azure
Connect-AzureAD
A pop-up should appear asking you to authenticate
If you get the following error after trying to connect then you are possibly using PowerShell Core.
Connect-AzureAD: One or more errors occurred. (Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.): Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Connect-AzureAD: One or more errors occurred. (Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.)
Connect-AzureAD: Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Connect-AzureAD: One or more errors occurred. (Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.): Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
If you are able to successfully connect you will see a returned table showing your:
- Account
- Environment,
- Tenant ID
- Tenant Domain
- Account Type
What if you want to run cmdlets against a different Tennant.
Connect-AzureAD -Tenant <Tenant ID>
Where can I find the Tenant ID I hear you say?