« Previous 1 2
Microsoft 365 DSC
Outliers
Working with Configurations
In contrast to exporting, importing a configuration is comparatively simple. After all, everything is already configured. The command is Start-DSCConfiguration
and as an argument, you will pass in the path where the MOF file is stored. Use the Verbose
parameter here to have more options in case of errors. Again, it can take hours to complete the process:
Start-DSCConfiguration C:\DemoM365DSC\M365TenantConfig -Wait -Verbose -Force
You might see an error message stating that the request size was exceeded in WinRM. In this case, increase the size with the command:
winrm set winrm/config @{MaxEnvelopeSizekb="8192"}
DSC also lets you check a given configuration against a default every 15 minutes. If the default is not met, DSC can restore the desired state from the MOF file. This process is adjustable, and instructions can be found online [3].
An option to clone configurations is very useful, especially if you manage several tenants that have the same configurations. You can create all the settings on a master tenant and then export the configuration to other tenants.
Generating Evaluations
The ability to compare different configurations with each other is also interesting and would encompass exports of the same tenants at different times, as well as exports from different tenants. M365DSC lets you generate evaluations in Excel and HTML formats. An Excel file only documents one tenant, whereas HTML reports let you make comparisons. To generate a simple report, use:
New-M365DSCReportFromConfiguration
You can also pass in the -Type
parameter as Excel
or HTML
and use ConfigurationPath
to define the location of the configuration file – not the MOF file, but the M365TenantConfig.ps1
file (if you keep the default name).
The -OutputPath
parameter specifies the location of the report. You must specify the location and file name. Without a file name, if you choose the HTML
option, you will see the output in PowerShell, but the file will not be created on the filesystem. The Excel
option opens the file in Excel, but -OutputPath
has no meaning, because a file can only be saved in Excel. For a comparison use the command
New-M365DSCDeltaReport
with -Source
and -Destination
parameters, which also point to the respective configuration files. In this way you create an HTML file; again, you need to specify the location with -OutputPath
. If you omit the parameter, the HTML output is displayed on the PowerShell console.
Conclusions
DSC for Microsoft 365 can be used to archive configurations and restore them when needed. You can also compare different tenants – and don't forget the possibility to keep the settings of multiple tenants in sync easily and reliably. The administrative gains more than make up for the comparatively costly setup overhead.
Infos
- Microsoft 365 Desired State Configuration: https://microsoft365dsc.com
- Register-PnPAzureADApp cmdlet: https://pnp.github.io/powershell/cmdlets/Register-PnPAzureADApp.html?q=Register-PnPAzureADApp
- Setting up the Local Configuration Manager: https://learn.microsoft.com/en-us/powershell/dsc/managing-nodes/metaconfig?view=dsc-1.1&viewFallbackFrom=dsc-1.1.
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy ADMIN Magazine
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Most Popular
Support Our Work
ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.