Microsoft365DSC
Microsoft365DSC copied to clipboard
Export configuration Exchange Online display variable instead of tenant name
Details of the scenario you tried and the problem that is occurring
When exporting Exchange Online configuration, sometime, in some section like EXOHostedOutboundSpamFilterRule and subsection FromMemberOf: instead on displaying the right group mail address value it display the variable EX: it should display [email protected] but it displayed xxxxxxx@$OrganizationName
this appended with all the last module version, currently I'm at the version 1.22.629.1
This append too in this section : EXOTransportRule.....ExceptIfSentToMemberOf
Verbose logs showing the problem
Suggested solution to the issue
The DSC configuration that is used to reproduce the issue (as detailed as possible)
# insert configuration here
M365DSC module version 1.22.629.1
ExchangeOnline Management 2.0.5
The operating system the target node is running
Version of the DSC module that was used ('dev' if using current dev branch)
We use the $OrganizationName variable to make these exports more generic. This way an exported configuration can be applied to another tenant without the need for additional change. As soon as you would start to compile the configuration, the variable will be replaced with the domain of the admin user.
As Andy mentions, the variable is used to make the export more generic. This variable is created earlier in the script, based on the name of the username: $OrganizationName = $CredsCredential.UserName.Split('@')[1]
If the credentials you are using are [email protected], all references to mytenantname.com are replaced with $OrganizationName.
This is the problem, when I did an delta repport, sometime the variable is not replaced with the Tenant name and the delta show that there is difference, here a print screen of the delta section in problem
I use a service principal with a certificate thumbprint for the connection and in the -TenantId I've put the tenant name instead of the Tenant ID
Just reviewed the code and see that during the export either the last part of the username (when using credentials) or the tenantid (when using application authentication) is replaced by $OrganizationName
, but in the Exported configuration the $OrganizationName variable is only using the last part of the username. Will have a look to update this!
thanks!!