Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert Blueprint detects no resources to assess #2048

Closed
ghost opened this issue Jun 30, 2022 · 19 comments
Closed

Assert Blueprint detects no resources to assess #2048

ghost opened this issue Jun 30, 2022 · 19 comments
Labels

Comments

@ghost
Copy link

ghost commented Jun 30, 2022

Details of the scenario you tried and the problem that is occurring

Trying to run a Blueprint
This pop up shows no items to assess
Selected BluePrint contains (0) components to assess.
Initiating the Export of those (0) components from the tenant...
i have a blueprint as submitted on issue #2007

This then goes about trying to extract the whole of the m365 settings.
I am only trying to sort Endpoint/intune at the moment, but i get 186 options being downloaded.
I have tried a straight export with the intune settings, and then running it back as a blueprint (incase versions have changed it) but it doesnt detect anything to assess.

Verbose logs showing the problem

Suggested solution to the issue

The DSC configuration that is used to reproduce the issue (as detailed as possible)

# Generated by Microsoft365DSC from https://export.microsoft365dsc.com on 6/30/2022, 12:37:47 PM
# Visit https://microsoft365dsc.com for more information

# Getting client credential
$Credential = Get-Credential

# Exporting resources using credentials
Export-M365DSCConfiguration -Components @("IntuneAppConfigurationPolicy", "IntuneApplicationControlPolicyWindows10", "IntuneAppProtectionPolicyAndroid", "IntuneAppProtectionPolicyiOS", "IntuneASRRulesPolicyWindows10", "IntuneDeviceCategory", "IntuneDeviceCompliancePolicyAndroid", "IntuneDeviceCompliancePolicyAndroidDeviceOwner", "IntuneDeviceCompliancePolicyAndroidWorkProfile", "IntuneDeviceCompliancePolicyiOs", "IntuneDeviceCompliancePolicyMacOS", "IntuneDeviceCompliancePolicyWindows10", "IntuneDeviceConfigurationPolicyAndroidDeviceOwner", "IntuneDeviceConfigurationPolicyAndroidWorkProfile", "IntuneDeviceConfigurationPolicyiOS", "IntuneDeviceConfigurationPolicyWindows10", "IntuneDeviceEnrollmentLimitRestriction", "IntuneDeviceEnrollmentPlatformRestriction", "IntuneSettingCatalogASRRulesPolicyWindows10") -Credential $Credential

The operating system the target node is running

OsName : Microsoft Windows Server 2022 Datacenter Azure Edition
OsOperatingSystemSKU : 407
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage : en-US
OsMuiLanguages : {en-US}

Version of the DSC module that was used ('dev' if using current dev branch)

Generated with Microsoft365DSC version 1.22.629.1

@ghost
Copy link
Author

ghost commented Jun 30, 2022

Also seems just doing an export and then compare is not working either.

New-M365DSCDeltaReport
With totally different settings, reports no difference.
Even if i strip out intune and place teams - no difference!

@andikrueger andikrueger added Bug Something isn't working Core Engine labels Jun 30, 2022
@ykuijs ykuijs removed Bug Something isn't working Core Engine labels Jun 30, 2022
@andikrueger andikrueger added Bug Something isn't working Core Engine labels Jun 30, 2022
@ykuijs
Copy link
Member

ykuijs commented Jun 30, 2022

Did some troubleshooting on this and found the root cause:
The SCSensitivityLabel resource is using a sub class which has a Settings parameter.

When creating the Delta report, the DSCParser converts the DSC configuration into an object. The DSCParser is using the AST to parse through the DSC config and unfortunately the Settings parameter is being tagged as a Keyword by the AST. That is messing up the code, which in turn generates an incorrect object. That incorrect object is then processed by the Delta report code, which results in the errors 😢

The only way to fix this is to change the name of the Settings parameter to something that is not marked as a keyword, but this will mean a breaking change!

@ghost
Copy link
Author

ghost commented Jun 30, 2022

Oh no! so the DSC portion of this is effectively broken!

We can import and export but not actually check what state its at!

@ykuijs
Copy link
Member

ykuijs commented Jun 30, 2022

This only applies to the SCSensitivityLabel resource, all other resources should be fine.

Also, you should still be able to do a Test-DscConfiguration to see if your tenant is still in the Desired State or not.
Just the Delta report and documentation generation do not work as expected. They both use the DSCParser module.

@ykuijs
Copy link
Member

ykuijs commented Jul 1, 2022

Settings keyword is using to create Meta Configurations / LCM Configuration, for example:

[DSCLocalConfigurationManager()]
configuration LCMConfig
{
    Node localhost
    {
        Settings
        {
            RefreshMode = 'Push'
        }
    }
}

@MBstatsara
Copy link

This only applies to the SCSensitivityResource, all other resources should be fine.

Also, you should still be able to do a Test-DscConfiguration to see if your tenant is still in the Desired State or not. Just the Delta report and documentation generation do not work as expected. They both use the DSCParser module.

Hello
Can you provide a bit more details on how we test the config of a 365 tenant using Test-DSCconfiguration?
I thought this was for Server type config checks?

@ghost
Copy link
Author

ghost commented Jul 5, 2022

I am also struggling with getting test-dscconfiguration working, i thought it was missing some settings on my side!

@andikrueger
Copy link
Collaborator

You can test your configuration like this:

Test-DscConfiguration -Path "C:\Dsc\Configurations"

This requires you to have .mof file within the folder specified.

@ghost
Copy link
Author

ghost commented Jul 5, 2022

OK so this command is not in the scope of m365dsc
Its the same DSC setup but totally different ways of working, so just running
Test-DscConfiguration -Path "C:\Dsc\Configurations"
Will not work.
I'll have to spend some time actually changing files to MOF as they aren't natively done and the documentation for this is not clear

@andikrueger
Copy link
Collaborator

Generating a mof file is already built in into the configuration, if you exported this with M365DSC.

you need to compile the configuration. Basically it’s calling the exported ps1 file with the credentials parameter.

@ykuijs
Copy link
Member

ykuijs commented Jul 6, 2022

Performing a Test-DscConfiguration is default PowerShell Desired State Configuration functionality. In order to do this, you:

  1. Create a DSC Configuration (PS1 and potentially a PSD1 file), either manually or by running the export
  2. Compile this configuration into a MOF file
  3. Run the Test-DscConfiguration command to have the Local Configuration Manager test the Microsoft 365 tenant against the baseline you created in step 1
  4. The output of the Test-DscConfiguration cmdlet is a list of resources that are in and a list of resource that are not in the desired state.

More information can be found here: https://microsoft365dsc.com/user-guide/get-started/deploying-configurations/

@ykuijs
Copy link
Member

ykuijs commented Jul 6, 2022

To learn more about the basics of DSC, I highly recommend watching this training: Getting Started with PowerShell Desired State Configuration!

@ghost
Copy link
Author

ghost commented Jul 11, 2022

Hello
Was this somewhat patched in the latest update?
Im now getting this

`Exception calling "IndexOf" with "2" argument(s): "Index was out of range. Must be non-negative and less than the size
of the collection.
Parameter name: startIndex"
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.706.1\modules\M365DSCUtil.psm1:2282 char:9

  •     $endPosition = $fileContent.IndexOf("`r", $startPosition)
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : ArgumentOutOfRangeException

Exception calling "Remove" with "2" argument(s): "StartIndex cannot be less than zero.
Parameter name: startIndex"
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.706.1\modules\M365DSCUtil.psm1:2283 char:9

  •     $fileContent = $fileContent.Remove($startPosition, $endPositi ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : ArgumentOutOfRangeException

Selected BluePrint contains (4) components to assess.
Initiating the Export of those (4) components from the tenant...`

@NikCharlebois
Copy link
Collaborator

Any chances you could share your blueprint here? It appears that the blueprint you are using doesn't define a module version in it via Import-DscResource.

@ghost
Copy link
Author

ghost commented Jul 13, 2022

It did actually create a report this time, I'll grab the blueprint and share it here, but I'm sure I just did an export and then tested it again.
Before the last update, any blueprint was not able to see any items to check again and we basically just check every single item against nothing from the blueprint.

@NikCharlebois
Copy link
Collaborator

Ok, then would you consider this issue fixed? Thanks

@ghost
Copy link
Author

ghost commented Jul 14, 2022

I'm not sure if it's working correctly or not, I didn't get a chance to do it yet today but will share blueprint shortly

@NikCharlebois
Copy link
Collaborator

@martynstar any updates on this? Thanks

@ghost
Copy link
Author

ghost commented Jul 19, 2022

Yes sorry let's close this for now.
I'm able to run the blueprints but the html heading coding etc for highlighting differences doesn't work but everything else does

@ghost ghost closed this as completed Jul 19, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants