Office 365: How to impersonate a service account in Exchange Online!

As happens in Exchange OnPremises, it’s possible to impersonate a service account in Exchange Online (EXO) so third party tools can use account permisssions to perform operations in EXO. In order to impersonate a service account in EXO you will need to execute a PowerShell script similar to the following one:

$sUserName="<O365User>@<O365Domain>.onmicrosoft.com"
$sMessage="Introduce your O365 Credentials"
$Cred=Get-Credential -UserName $sUserName -Message $sMessage
#Configure a Group to use classification:
$PSSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Cred -Authentication Basic -AllowRedirection
Import-PSSession $PSSession

Get-ManagementRoleAssignment 

Enable-OrganizationCustomization
$sAccountToBeImpersonated="<ServiceAccount>@<O365Domain>.onmicrosoft.com"
$sImpersonationScopeName="<Your Impersonation Scope Name>"
New-ManagementRoleAssignment -name:$sImpersonationScopeName -Role:ApplicationImpersonation -User:$sAccountToBeImpersonated

Reference:

Anuncios

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s