Office365-Scoutnet-synk

Synkronisering av användarkonton och e-postlistor från Scoutnet till Office 365


Project maintained by Scouterna Hosted on GitHub Pages — Theme by mattgraham

Connect-SnSOffice365

Connects to Microsoft Graph and Exchange Online.

Description

Signs in to Microsoft Graph and Exchange Online. Run it once before the synchronization functions.

The sign-in uses the domain name, scopes and allowed Exchange commands from the configuration. Exchange Online is connected with only the commands the module needs (CommandName in the configuration).

Interactive (default): uses device code sign-in for both services. Follow the instructions written to the console and sign in with an account that is allowed to make the changes.

With -ManagedIdentity: uses the system-assigned managed identity of the Azure Automation account. The identity needs the Graph application permissions, the Exchange.ManageAsApp permission and the Exchange Administrator role, which setupAzure.ps1 gives it.

Throws an error if no configuration is available, or if the sign-in fails.

Syntax

Connect-SnSOffice365 [-Configuration <Object>] [-ManagedIdentity] [<CommonParameters>]

Parameters

-Configuration

Type: Object; optional.

Configuration to use, created with New-SNSConfiguration. It is cached in the module, so it can be left out if a configuration has already been given in this session.

-ManagedIdentity

Type: SwitchParameter; optional.

Sign in with the managed identity of the Azure Automation account instead of device code. Use this when the synchronization runs in an Azure runbook.

Examples

Example 1

$conf = New-SNSConfiguration -LicenseAssignment $licenseAssignment
$conf.DomainName = 'example.se'
Connect-SnSOffice365 -Configuration $conf

Signs in interactively with device code, using the given configuration.

Example 2

Connect-SnSOffice365 -ManagedIdentity -Configuration $conf -ErrorAction Stop

Signs in with the managed identity in an Azure runbook.