/ Office 365 / Powershell

Conexión remota a Powershell de Office 365

Hola a todos!

Veremos cómo conectarnos remotamente a la consola de Office 365.

function Connect-O365(){
Import-Module msonline
#USUARIO
$userL="USUARIO DE ADMINISTRADOR GLOBAL"
#CONTRASEÃ
$passL='CONTRASEÃ DE ADMINISTRADOR GLOBAL'
#ENCRIPTA LA CONTRASEÃ
$encrypted = ConvertTo-SecureString $passL .asplaintext .force
$cred= New-Object System.Management.Automation.PsCredential($userL, $encrypted)
#CONEXIÃ AL OFFICE365
$Credentials = $cred
Import-Module msonline
Connect-MsolService -Credential $Credentials
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell/ -Credential $Credentials -Authentication Basic -AllowRedirection
Import-PSSession $Session
}
Connect-O365
#VERIFICAR SESIÃ
Get-PSSession
view raw Connect O365.ps1 hosted with ❤ by GitHub

Una vez ejecutado, tendremos acceso a todos los cmdlets de Office 365.