Export-M365DSCConfiguration¶
Description¶
Entry point for ReverseDSC export. Validates authentication inputs, resolves target resources, executes extraction, and returns the generated configuration content.
Output¶
This function does not generate any output.
Parameters¶
| Parameter | Required | DataType | Default Value | Allowed Values | Description |
|---|---|---|---|---|---|
| LaunchWebUI | False | SwitchParameter | Indicates that the export Web UI should be launched. | ||
| Path | False | String | Specifies the output path for exported configuration files. | ||
| FileName | False | String | Specifies the output configuration file name. | ||
| ConfigurationName | False | String | Specifies the generated DSC configuration name. | ||
| Components | False | String[] | Specifies component names to export. | ||
| ExcludeComponents | False | String[] | Specifies component names to exclude. | ||
| Workloads | False | String[] | AAD, ADO, AZURE, COMMERCE, DEFENDER, EXO, FABRIC, INTUNE, O365, OD, PLANNER, PP, SC, SENTINEL, SH, SPO, TEAMS, VIVA | Specifies workloads used to derive components. | |
| Mode | False | String | Default | Default, Full | Specifies the export mode. |
| GenerateInfo | False | Boolean | Indicates whether informational metadata should be generated in export output. | ||
| Filters | False | Hashtable | Specifies resource-level filters used during export. | ||
| ApplicationId | False | String | Specifies the application id used for app-based authentication. | ||
| TenantId | False | String | Specifies the tenant id or tenant domain used for authentication. | ||
| ApplicationSecret | False | String | Specifies the application secret used for app-based authentication. | ||
| CertificateThumbprint | False | String | Specifies the certificate thumbprint used for app-based authentication. | ||
| Credential | False | PSCredential | Specifies delegated credentials used for authentication. | ||
| CertificatePassword | False | PSCredential | Specifies the password used to read the certificate file. | ||
| CertificatePath | False | String | Specifies the certificate file path used for app-based authentication. | ||
| ManagedIdentity | False | SwitchParameter | Indicates that managed identity authentication should be used. | ||
| AccessTokens | False | String[] | Specifies one or more pre-acquired access tokens. | ||
| SubscriptionId | False | String | Specifies the Azure subscription id used by Azure resources. | ||
| Validate | False | SwitchParameter | Indicates whether the exported configuration should be validated. | ||
| Parallel | False | SwitchParameter | Indicates whether export should execute in parallel. | ||
| TokenReplacement | False | Hashtable | Specifies token replacement mappings applied to exported content. | ||
| WithStatistics | False | SwitchParameter | Indicates whether export statistics should be collected. | ||
| IncludeDependencies | False | SwitchParameter | Indicates whether dependency extraction and DependsOn generation should run. |
Examples¶
-------------------------- EXAMPLE 1 --------------------------
Export-M365DSCConfiguration -Components @("AADApplication", "AADConditionalAccessPolicy", "AADGroupsSettings") -Credential $Credential
-------------------------- EXAMPLE 2 --------------------------
Export-M365DSCConfiguration -Mode 'Default' -ApplicationId '2560bb7c-bc85-415f-a799-841e10ec4f9a' -TenantId 'contoso.sharepoint.com' -ApplicationSecret 'abcdefghijkl'
-------------------------- EXAMPLE 3 --------------------------
Export-M365DSCConfiguration -Components @("AADApplication", "AADConditionalAccessPolicy", "AADGroupsSettings") -Credential $Credential -Path 'C:\DSC' -FileName 'MyConfig.ps1'
-------------------------- EXAMPLE 4 --------------------------
Export-M365DSCConfiguration -Credential $Credential -Filters @{AADApplication = "DisplayName eq 'MyApp'"} -TokenReplacement @{ 'alternate-email.onmicrosoft.com' = 'AlternateEmail' }
-------------------------- EXAMPLE 5 --------------------------
Export-M365DSCConfiguration -Workloads @("SPO") -ExcludeComponents @("SPOPropertyBag") -Credential $Credential
-------------------------- EXAMPLE 6 --------------------------
Export-M365DSCConfiguration -Workloads @("SPO") -ApplicationId $clientId -TenantId $tenantName -CertificateThumbprint $certThumbprint -IncludeDependencies