Getting Started with Office365DSC

Office365DSC is an Open-Sourced PowerShell module that allows you to define the configuration of your Office 365 Tenants as code. This makes it easier to integrate Office 365 deployments with your existing Continuous Integration and Delivery pipelines. Since the module relies on PowerShell Desired State Configuration, it also automatically monitors your Office 365 tenants for configuration drifts. As if this was not enough, Office365DSC is also the very first DSC module out-there to have native ReverseDSC support in it. Users can therefore extract full-fidelity configuration scripts out of their existing tenants.

The present article describes the steps to install and run Office365DSC on a brand new machine. At the time of writing this article, the module is still in an alpha version. The plan is to have the module “RTM” during the 2019 SharePoint North America conference at the end of May. Because most machines don’t have the latest version of the PowerShellGet module which allows you to automatically grab PreRelease versions of modules from the PowerShell Gallery, we will need to start by updating this module.

Installation Steps

This section describes the steps that need to be performed in order to install the Office365DSC module onto a machine or server. Please note that these steps require PowerShell version 5.0 or greater.

Update PowerShellGet

Open a new PowerShell session as an administrator and run the following lines of PowerShell to update your module:

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module PowerShellGet -Force

Open a New PowerShell Session

In order to be able to leverage the newly installed versions of PowerShellGet we need to close the existing PowerShell session and re-open a new one.

Install the Office365DSC Module

We are now ready to install our Office365DSC module by running the following line of PowerShell code:

Install-Module Office365DSC -Force -AllowPreRelease

Usage

Once the module is installed, you can now execute your configuration locally which will automatically trigger a connection to your Office 365 tenant. You are now also able to trigger the ReverseDSC console by simply running the following PowerShell command:

Export-O365Configuration

Running the above command will launch the Office365DSC ReverseDSC Graphical Interface as shown below. Simply select the components you wish to extract, enter the credentials of a Global Administrator account for your tenant in the top right section, and click the Start Extraction button.

ReverseDSC for Office 365

This will automatically initiate an extraction of the existing configuration from your existing Office 365 tenant. Once the extraction completes, you will be prompted to provide a path to store the extracted configuration. If the path you provided doesn’t exist, the module will automatically create it.

Office 365 extraction

Leave a Reply

Your email address will not be published. Required fields are marked *