Comments (17)
Thank you for the resource snippets. There is something wrong with the escaping of quotes. Your strings contain quotes and these are breaking the resource’s configuration
from microsoft365dsc.
Please write down which properties you had to modify in order to escape those extra quotes in the code.
from microsoft365dsc.
We need to modify this function in ReverseDSC for this matter:
In this function there is already some handling present for invalid string characters like `. We should extend this handling to properly escaping double quotes. In the generated DSC blocks we always use double quotes to define string.
from microsoft365dsc.
I guess we also need to look into the Array processing then for SubjectOrBodyMatchesPatterns
. The json should still be fine with proper escaping of the quotes. As soon as the quotes are escaped the brackets will no longer matter.
from microsoft365dsc.
Any help on this?
from microsoft365dsc.
Could you share the resources configuration for this case? This looks like either an issue in DSCParser or in the export method of EXOTransportRule. Thanks!
from microsoft365dsc.
As the Resource config is a very large file with 300+ transport rules, I am sharing you snippets of the config from where I can find the errors from VS Code. The html report is totally broken.
PowerShell Version - 5.1
from microsoft365dsc.
There is an incomplete property assignment block in the instance definition.
Unexpected token 'BCC” Field. Thank You."' in expression or statement.
EXOTransportRule "EXOTransportRule-redacted"
{
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
ApplyOME = $False;
AttachmentHasExecutableContent = $False;
AttachmentIsPasswordProtected = $False;
AttachmentIsUnsupported = $False;
AttachmentProcessingLimitExceeded = $False;
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
Comments = "redacted";
DeleteMessage = $False;
Enabled = $True;
Ensure = "Present";
ExceptIfAttachmentHasExecutableContent = $False;
ExceptIfAttachmentIsPasswordProtected = $False;
ExceptIfAttachmentIsUnsupported = $False;
ExceptIfAttachmentProcessingLimitExceeded = $False;
ExceptIfHasNoClassification = $False;
From = @("redacted");
FromScope = "InOrganization";
HasNoClassification = $False;
HeaderContainsMessageHeader = "To";
HeaderContainsWords = @("redacted","redacted");
Mode = "Enforce";
ModerateMessageByManager = $False;
Name = "redacted";
Priority = 124;
Quarantine = $False;
RecipientAddressType = "Resolved";
RejectMessageEnhancedStatusCode = "5.7.1";
RejectMessageReasonText = "This email has been blocked as the recipient marked in the mail is not in “BCC” Field. Thank You.";
RemoveOME = $False;
RemoveOMEv2 = $False;
RemoveRMSAttachmentEncryption = $False;
RouteMessageOutboundRequireTls = $False;
RuleErrorAction = "Ignore";
RuleSubType = "None";
SenderAddressLocation = "HeaderOrEnvelope";
SentToScope = "InOrganization";
SetAuditSeverity = "Medium";
StopRuleProcessing = $True;
TenantId = $OrganizationName;
}
The above error is same for multiple transport rules where the transport rule looks same.
The 'from' keyword is not supported in this version of the language. For this error, I am sharing few transport rules from resource config. Few transport rules with from parameter has no error.
EXOTransportRule "EXOTransportRule-redacted"
{
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
ApplyOME = $False;
AttachmentHasExecutableContent = $False;
AttachmentIsPasswordProtected = $False;
AttachmentIsUnsupported = $False;
AttachmentProcessingLimitExceeded = $False;
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
Comments = "redacted";
DeleteMessage = $False;
Enabled = $True;
Ensure = "Present";
ExceptIfAttachmentHasExecutableContent = $False;
ExceptIfAttachmentIsPasswordProtected = $False;
ExceptIfAttachmentIsUnsupported = $False;
ExceptIfAttachmentProcessingLimitExceeded = $False;
ExceptIfHasNoClassification = $False;
From = @(redacted); # more then 50 senders
FromScope = "NotInOrganization";
HasNoClassification = $False;
Mode = "Enforce";
ModerateMessageByManager = $False;
Name = "redacted";
Priority = 140;
Quarantine = $False;
RecipientAddressType = "Resolved";
RemoveOME = $False;
RemoveOMEv2 = $False;
RemoveRMSAttachmentEncryption = $False;
RouteMessageOutboundRequireTls = $False;
RuleErrorAction = "Ignore";
RuleSubType = "None";
SenderAddressLocation = "HeaderOrEnvelope";
SetSCL = "redacted";
StopRuleProcessing = $True;
TenantId = $OrganizationName;
}
EXOTransportRule "EXOTransportRule-redacted"
{
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
ApplyOME = $False;
AttachmentHasExecutableContent = $False;
AttachmentIsPasswordProtected = $False;
AttachmentIsUnsupported = $False;
AttachmentProcessingLimitExceeded = $False;
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
Comments = "redacted
";
DeleteMessage = $False;
Enabled = $True;
Ensure = "Present";
ExceptIfAttachmentHasExecutableContent = $False;
ExceptIfAttachmentIsPasswordProtected = $False;
ExceptIfAttachmentIsUnsupported = $False;
ExceptIfAttachmentProcessingLimitExceeded = $False;
ExceptIfHasNoClassification = $False;
From = @("redacted");
HasNoClassification = $False;
HeaderContainsMessageHeader = "redacted";
HeaderContainsWords = @("yes");
Mode = "Enforce";
ModerateMessageByManager = $False;
Name = "redacted";
Priority = 221;
Quarantine = $False;
RecipientAddressType = "Resolved";
RedirectMessageTo = @("redacted");
RemoveOME = $False;
RemoveOMEv2 = $False;
RemoveRMSAttachmentEncryption = $False;
RouteMessageOutboundRequireTls = $False;
RuleErrorAction = "Ignore";
RuleSubType = "None";
SenderAddressLocation = "Header";
SentTo = @("redacted");
SetAuditSeverity = "High";
StopRuleProcessing = $True;
TenantId = $OrganizationName;
}
Unexpected token 'application/adaptivecard+json">"' in expression or statement.
EXOTransportRule "EXOTransportRule-redacted"
{
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
ApplyOME = $False;
AttachmentHasExecutableContent = $False;
AttachmentIsPasswordProtected = $False;
AttachmentIsUnsupported = $False;
AttachmentProcessingLimitExceeded = $False;
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
Comments = "redacted";
DeleteMessage = $False;
Enabled = $True;
Ensure = "Present";
ExceptIfAttachmentHasExecutableContent = $False;
ExceptIfAttachmentIsPasswordProtected = $False;
ExceptIfAttachmentIsUnsupported = $False;
ExceptIfAttachmentProcessingLimitExceeded = $False;
ExceptIfHasNoClassification = $False;
HasNoClassification = $False;
Mode = "Enforce";
ModerateMessageByManager = $False;
Name = "redacted";
Priority = 280;
Quarantine = $False;
RecipientAddressType = "Resolved";
RemoveOME = $False;
RemoveOMEv2 = $False;
RemoveRMSAttachmentEncryption = $False;
RouteMessageOutboundRequireTls = $False;
RuleErrorAction = "Ignore";
RuleSubType = "None";
SenderAddressLocation = "Header";
SetHeaderName = "redacted";
SetHeaderValue = "any";
StopRuleProcessing = $False;
SubjectOrBodyMatchesPatterns = @("<script type="application/adaptivecard\+json">");
TenantId = $OrganizationName;
}
Unexpected token '}' in expression or statement.
In the html report we are seeing like these for all the rules where the "from" error started.
from microsoft365dsc.
Could you share the resources configuration for this case? This looks like either an issue in DSCParser or in the export method of EXOTransportRule. Thanks!
@andikrueger @NikCharlebois please help us here.
from microsoft365dsc.
Thank you for the resource snippets. There is something wrong with the escaping of quotes. Your strings contain quotes and these are breaking the resource’s configuration
These quotes are opened and closed as well. The transport rules does not contain such quotes in the comment section or any string value which are part of the transport rule. Is there anyhow you can help us with this. We have a lot of transport rules and monitoring is essential.
from microsoft365dsc.
Just to clarify: The resources and their configurations were created using Export-M365DSCConfiguration?
from microsoft365dsc.
Just to clarify: The resources and their configurations were created using Export-M365DSCConfiguration?
Yes, I am working on removing the quotes"" where the errors are occurring. I will update if the issue is fixed permanently. The errors are getting reduced as of now. I am thoroughly checking the configuration.
from microsoft365dsc.
@ricmestre Shouldn't we run escaping on all string properties regardless of the name before pushing them into the output stream
from microsoft365dsc.
If it doesn't impact anything else sure, it's better than doing it one by one.
from microsoft365dsc.
Please write down which properties you had to modify in order to escape those extra quotes in the code.
I have removed the double quotes from some parameters such as comments and RejectMessageReasonText and now I do not see the error. I will test this over the weekend and coming monday to know for sure. As of now the html is also being generated fine.
Still there are few errors for
SubjectOrBodyMatchesPatterns : {"type":"AdaptiveCard","originator":"[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}"}
I think removing the double quotes and [] can impact the transport rule.
Can we accept the double quotes, brackets in coming releases for transport rules ?
from microsoft365dsc.
We need to modify this function in ReverseDSC for this matter:
In this function there is already some handling present for invalid string characters like `. We should extend this handling to properly escaping double quotes. In the generated DSC blocks we always use double quotes to define string.
This would be really great once done. I am a newbie to scripts, otherwise I would have done myself, still learning. Apart from quotes, it would be great if it was extended to brackets as well.
from microsoft365dsc.
I guess we also need to look into the Array processing then for
SubjectOrBodyMatchesPatterns
. The json should still be fine with proper escaping of the quotes. As soon as the quotes are escaped the brackets will no longer matter.
@andikrueger will the fix be available in the upcoming release ?
from microsoft365dsc.
Related Issues (20)
- ManagementRole attributes HOT 3
- New parameters needed for Exchange resource HOT 4
- Proposal for a new Exchange resource - ActiveSyncOrganizationSettings
- AADGroup: Get-MgGroupMemberOf : The stream was already consumed. It cannot be read again.
- AADGroup: Get-MgGroupOwner : Lifetime validation failed, the token is expired.
- TeamsTenantDialPlan: NormalizationRules is not being properly inserted in the blueprint
- AADApplication: Creating enterprise apps and associated SPN from the gallery
- EXOSharedMailbox: Invoke-DscResource: Resource not found HOT 5
- Unable to Export AADgroup(s) HOT 1
- AADAdministrativeUnit: Cannot leave 'Ensure' as default HOT 5
- AADAdministrativeUnit resource still uses Beta cmdlets
- Discussion: Support for read-only properties and resources in M365DSC HOT 1
- TeamsVoiceRoute question
- Error while extracting the Accepted Domain list HOT 1
- IntuneAppConfigurationPolicy: Comparison problem in Test-TargetResource
- Applying different DSC rules to different workloads HOT 4
- [AADConditionalAccessPolicy]: ConditionalAccessPolicies applying before User creation HOT 1
- Adding Intune as a resource from the Whitepaper configuration HOT 3
- AADApplication: Get-DSCConfiguration not working HOT 3
- Groups not assigned correctly to policies HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microsoft365dsc.