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. 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

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

11 thoughts on “Getting Started with Office365DSC

  1. After running Export-O365Configuration and selecting start extraction im not prompted to enter a location so the export doesnt happen. Any ideas?

    1. I had the same issue, one of the modules (O365 groups) failed without any error. I had to uncheck the option and it worked to the end afterwards. On the other tenant, I was able to export with all the options though.

      1. Some changes were recently made to the O365Group resource. I recommend you try grabbing the latest version from the gallery and let me know if you still run into the issue.

  2. Thanks for responding. So after running that command, the extract goes through the motions of extracting and writes the output to the screen but then randomly stops part way through the extract and there is no prompt to enter a location to save the extract.

  3. PS C:\Windows\system32> Export-O365Configuration
    WARNING: The names of some imported commands from the module ‘SharePointPnPPowerShellOnline’ include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the
    Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
    WARNING: The names of some imported commands from the module ‘Microsoft.Online.SharePoint.PowerShell’ include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs,
    run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
    Extracting O365AdminAuditLogConfig…
    WARNING: The names of some imported commands from the module ‘tmp_uajvwrol.0pg’ include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module
    command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
    WARNING: The names of some imported commands from the module ‘tmp_uajvwrol.0pg’ include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module
    command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
    Extracting EXOAtpPolicyForO365…
    Extracting EXOCASMailboxPlan…
    Extracting EXOClientAccessRule…
    Extracting EXODkimSigningConfig…
    Extracting EXOHostedConnectionFilterPolicy…
    Extracting EXOHostedContentFilterPolicy…
    Extracting EXOHostedContentFilterRule…
    The current tenant doesn’t have access to Safe Attachment Policy APIs.
    Extracting EXOSafeAttachmentRule…
    Extracting EXOSafeLinksPolicy…
    Extracting EXOSafeLinksRule…
    Extracting EXOMailTips…
    – [1/] SHC_SHM_SharedCalender
    Extracting O365User…
    – [1/11] TeamsDR@
    – [2/11] oaa_a332b3a6ede24eedb8a3a344a2a1d5d4@
    – [3/11] ServiceAccount_AdminDroid@
    – [4/11] SfBMobile@
    – [5/11] MicrosoftCloudUCCConsultantArchitect@
    – [6/11] shawn@
    – [7/11] admin@
    – [8/11] shc_shm_@
    – [9/11] hg_6b0d7af5481544e3a6cab7ff9e2afadd@
    – [10/11] mark#EXT#@
    – [11/11] sharry@
    Extracting O365Group…
    – [1/64] RTCUniversalUserAdmins
    – [2/64] Skype for Business Project Plan
    – [3/64] Exchange Windows Permissions
    – [4/64] GroupChatGroup
    PS C:\Windows\system32>

    I’ve also noticed that the extraction modes (lite, default and full) on the ReverseDSC UI/windows dont show. One other question can this module extract the SfBO config too? Or just Teams only?

  4. Hi, is there any guide on how to promote changes to a tenant? Still struggling to find any info.

    1. Once you wrote your configuration, you need to compile it into a MOF file by calling the name of the configuration as if it was a regular PowerShell function. Then you’ll simply have to run Start-DSCConfiguration against the folder that got generated with the .MOF files to initiate the configuration of the tenant.

  5. I don’t see the “Lite”, “Default” and “Full” buttons as shown in the above image of the Office365DSC ReverseDSC Graphical Interface. Should those options be available in the currently released version (1.0.0.6)?

    1. These are legacy from SharePoint ReverseDSC (on-premises). They have been hidden from O365DSC. We are still investigating what component it would make sense to include in each subset, but will most likely re-inteoduce them in a future version

Leave a Reply

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