ExchangeOnlineManagement 3.8.0-Preview1 released

ExchangeOnlineManagement 3.8.0-Preview1 released

Hi All,

A few Days ago, Microsoft has released the ExchangeOnlineManagement 3.8.0-Preview1 PowerShell Module.

v3.8.0-Preview1:

  • Support for providing an Access Token with Connect-IPPSSession.

I am using the new PSResourceGet here instead of the PowerShellGet commands.

Show installed Versions and what’s available in PowerShell Gallery. You need to use the -Prerelease Parameter to show Preview Versions of a Module

Get-InstalledPSResource ExchangeOnlineManagement -Scope CurrentUser
Find-PSResource ExchangeOnlineManagement -Prerelease

Uninstall old Module

Uninstall-PSResource ExchangeOnlineManagement -Scope CurrentUser -SkipDependencyCheck

I’ve updated the M365PSProfile PowerShell Module and the Uninstall-M365Module Function with the Parameter -FileMode. It will delete the Module Folder of that Module.

Uninstall-M365Module -Modules ExchangeOnlineManagement -Scope CurrentUser -FileMode

Installing the Module and show the installed Module

Install-PSResource -Name ExchangeOnlineManagement -Scope CurrentUser -Prerelease
Get-InstalledPSResource -Name ExchangeOnlineManagement -Scope CurrentUser

Connect to Exchange Online and get a Mailbox

Connect-ExchangeOnline -ShowBanner:$false
Get-Mailbox -Identity a.bohren@icewolf.ch
Disconnect-ExchangeOnline -Confirm:$false

Connect-IPPSSession with Access Token

We need to set up an Entra Application as described here

Entra Application

Certificate for Authentication

Application Permission: Exchange.ManageAsApp (with Grant Admin Consent)

The Entra App needs to be addet to one of the Roles needed for Security & Compliance Powershell

In my Example here i’ve used “Security Administrator”

Getting Access Token with PSMSALNet PowerShell Module (Requires PowerShell 7.4)

###############################################################################
# Setting up Variables
###############################################################################
Import-Module PSMSALNet
$TenantId = "46bbad84-29f0-4e03-8d34-f6841a5071ad"
$AppID = "f38d26a7-740e-425f-aef5-2da3f3d595db" #ExOPowershellV2
$RedirectUri = "https://login.microsoftonline.com/common/oauth2/nativeclient"
$Scope = "https://ps.compliance.protection.outlook.com"
$CertificateThumbprint = "A3A07A3C2C109303CCCB011B10141A020C8AFDA3" #CN=O365Powershell4
$Certificate = Get-ChildItem -Path cert:\CurrentUser\my\$CertificateThumbprint

###############################################################################
# Authenticate with Certificate
###############################################################################
$HashArguments = @{
  TenantId = $TenantId
  ClientId = $AppID
  ClientCertificate = $Certificate
  Resource = 'Custom'
  CustomResource = $Scope
}

#Get AccessToken
$Token = Get-EntraToken -ClientCredentialFlowWithCertificate @HashArguments
$AccessToken = $token.AccessToken

Let’s decode the AcccessToken with JWTDetails Powershell Module

#View AccessToken
Get-JWTDetails -token $AccessToken

Import-Module ExchangeOnlineManagement
Connect-IPPSSession -AccessToken $AccessToken -Organization icewolfch.onmicrosoft.com -ShowBanner:$false

List the Commands of the Exported commands

Get-Module
Get-Command -Module tmpEXO_r1jdrgtn.jv2

Let’s use one of the Commands

Get-AdminAuditLogConfig

Regards
Andres Bohren

Exchange Logo

PowerShell Logo