Azure / Office 365 – PowerShell

Abhängigkeiten

Azure

Install-Module Azure
Import-Module Azure
Add-AzureAccount

Azure AD

Install-Module AzureAD
Import-Module AzureAD
Connect-AzureAD

Office 365

Install-Module MSOnline
Import-Module MSOnline
Connect-MsolService

Exchange Online

Wenn man MFA verwenden möchte, muss man die PowerShell Umgebung über die ECP aufbauen. Ansonsten so:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking

Skype for Business Online

Das Modul wird automatisch durch das Setup installiert.

Import-Module SkypeOnlineConnector
$userCredential = Get-Credential
$sfbSession = New-CsOnlineSession -Credential $userCredential
Import-PSSession $sfbSession

Sharepoint Online

Install-Module -Name Microsoft.Online.SharePoint.PowerShell
Import-Module -Name Microsoft.Online.SharePoint.PowerShell
$adminUPN="<the full email address of a SharePoint administrator account, example: jdoe@contosotoycompany.onmicrosoft.com>"
$orgName="<name of your Office 365 organization, example: contosotoycompany>"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential