ASD's Blueprint for Secure Cloud

Automated deployment

This page describes the use of Microsoft 365 Desired State Configuration (DSC) to deploy a Blueprint configuration.

Estimated reading time: 4 minutes

Overview

Microsoft 365 Desired State Configuration (M365DSC) is a configuration-as-code tool developed by Microsoft to automate the configuration of Microsoft 365 services. It is the primary tool used to automate the deployment of the configuration guidance in the Blueprint.

Deployment steps

1. Complete the prerequisite tasks

A Windows host and additional configurations are required for the following steps, instructions for these are in the DSC setup page.

2. Copy the DSC files

On the Windows host, download the DSC file for the targeted M365 service to your working folder:

ServiceDeployment coverage
Entra IDPartial
Microsoft 365None
Microsoft IntunePartial
Microsoft DefenderPartial
Microsoft PurviewPartial
Exchange OnlinePartial
SharePoint OnlinePartial
Microsoft TeamsFull
Power PlatformNone

3. Update the DSC version in the DSC file

The DSC file requires the same versioning as the modules used for importing, update the ModuleVersion parameter for the Import-DscResource command in the DSC file with your DSC version.

The module version can be displayed with:

Get-Module Microsoft365DSC -ListAvailable | select ModuleBase, Version

4. Determine the required resource permissions for the targeted M365 service

The M365DSC service principal created during the initial setup will require administrative permissions to the targeted M365 service’s APIs. The resources specific to the Blueprint that require administrative permissions are listed on the above-linked targeted service’s configuration index configuration page, along with any specific instructions for using DSC to configure the service.

If significant time has passed since performing the initial setup, you may need to re-authenticate before proceeding. Authenticate to your Entra ID tenant with an account with permissions to update the M365DSC app’s permissions:

$creds = Get-Credential

On the Windows host used for deployment, in an elevated PowerShell prompt, update the app with the permissions required for the targeted M365 service, substituting the resource permissions required for your targeted service:

Update-M365DSCAzureAdApplication -ApplicationName 'M365DSC' -Permissions $(Get-M365DSCCompiledPermissionList -ResourceNameList <resource permissions> -PermissionType Application -AccessType Update) -Credential $creds

5. Compile the MOF file

Execute the DSC script to compile a MOF file, for example:

PS C:\DSC> .\entradsc.ps1

    Directory: C:\DSC\M365TenantConfig

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----               #####                 108984 localhost.mof

This will create a folder named M365TenantConfig in which the MOF file will be placed.

6. Deploy the configuration

Execute the following command to deploy the configuration to the targeted M365 service, substituting the full path of the M365TenantConfig folder:

Start-DSCConfiguration -Path <M365TenantConfig folder> -Wait -Verbose -Force

After the configuration has finished deploying, execute the following commands to stop the M365DSC process:

Stop-DSCConfiguration -Force
Remove-DSCConfigurationDocument -Stage Current

This will stop M365DSC from monitoring for configuration drift.

7. Remove permissions

Remove all app permissions, and any service principal role assignments or other service-specific permissions, after DSC operations.

Troubleshooting

If any settings fail to deploy automatically then they will require manual configuration.

If significant or reoccurring errors are encountered, please feel free to contact us using the details in the footer of this page.

Configuration

Tools

References

Do you have a suggestion on how the above page could be improved? Get in touch! ASD's Blueprint for Secure Cloud is an open source project, and we would love to get your input. Submit an issue on our GitHub, or send us an email at blueprint@asd.gov.au

Acknowledgement of Country icon

Acknowledgement of Country
We acknowledge the Traditional Owners and Custodians of Country throughout Australia and their continuing connections to land, sea and communities. We pay our respects to them, their cultures and their Elders; past, present and emerging. We also recognise Australia's First Peoples' enduring contribution to Australia's national security.

Authorised by the Australian Government, Canberra