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

PlannerTask: Quotes not removed around ApplicationId, CertificateThumbprint, TenantId etc #2784

Closed
bjoernf73 opened this issue Jan 16, 2023 · 0 comments · Fixed by #2785 or #2800
Closed
Labels
Bug Something isn't working Planner

Comments

@bjoernf73
Copy link
Contributor

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

Previously, only Credential auth was supported for Planner, therefore, in MSFT_PlannerTask.psm1, function Export-TargetResource, line 787:

$content = Convert-DSCStringParamToVariable -DSCBlock $content `
    -ParameterName 'Credential'

ensures that quotes are removed around $ConfigurationData.NonNodeData.Credential:

PlannerTask 7ad38863-ce48-4b8e-b169-c292222471e6
{
    Bucket = "nYij0yLaMJ-KKPkQnX1wGpcAMF4C";
    Categories = @("Blue");
    Credential = $ConfigurationData.NonNodeData.Credential;
    DueDateTime = "15.05.2019 10:00:00";
    Ensure = "Present";
    PercentComplete = 100;
    PlanId = "j0P6vPeqpUiI2UUlwClBjZcAHXJ4";
    Priority = 5;
    TaskId = "SC81Z9zF9EGMlI76hYauj5cAD8o4";
    Title = "Some Title";
}

However, if for instance if Certificate is used for auth, quotes are not removed for properties related to that (i.e. CertificateThumbPrint, ApplicationId, TenantId):

PlannerTask 7ad38863-ce48-4b8e-b169-c292222471e6
{
    # ApplicationId will fail because of the quotes below
    ApplicationId = "$ConfigurationData.NonNodeData.ApplicationId";
    Bucket = "nYij0yLaMJ-KKPkQnX1wGpcAMF4C";
    Categories = @("Blue");
    # CertificateThumbprint will fail because of the quotes below
    CertificateThumbprint = "$ConfigurationData.NonNodeData.CertificateThumbprint";
    DueDateTime = "15.05.2019 10:00:00";
    Ensure = "Present";
    PercentComplete = 100;
    PlanId = "j0P6vPeqpUiI2UUlwClBjXcAHXJ4";
    Priority = 5;
    TaskId = "SC91Z8zF9EGMlI76hYauj5cAD8o4";
    # TenantId will fail because of the quotes below
    TenantId = "$ConfigurationData.NonNodeData.TenantId";
    Title = "Some task";
}

Verbose logs showing the problem

n/a

Suggested solution to the issue

Change the following in MSFT_PlannetTask.psm1, function Export-TargetResource, starting at line 787:

$content = Convert-DSCStringParamToVariable -DSCBlock $content `
    -ParameterName 'Credential'

with the following lines:

# Ensure quotes are removed around auth variables
if ($Credential) 
{
    $content = Convert-DSCStringParamToVariable -DSCBlock $content `
        -ParameterName 'Credential'
}
if ($ApplicationId) 
{
    $content = Convert-DSCStringParamToVariable -DSCBlock $content `
        -ParameterName 'ApplicationId'
}
if ($ApplicationSecret) 
{
    $content = Convert-DSCStringParamToVariable -DSCBlock $content `
        -ParameterName 'ApplicationSecret'
}
if ($TenantId) 
{
    $content = Convert-DSCStringParamToVariable -DSCBlock $content `
        -ParameterName 'TenantId'
}
if ($CertificateThumbprint) 
{
    $content = Convert-DSCStringParamToVariable -DSCBlock $content `
        -ParameterName 'CertificateThumbprint'
}

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

just exporting

The operating system the target node is running

OsName : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : en-US
OsMuiLanguages : {en-US, nb-NO}

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

Dev

@andikrueger andikrueger added Bug Something isn't working Planner labels Jan 17, 2023
ykuijs added a commit that referenced this issue Jan 17, 2023
Removes quotes around vars for auths - fixes #2784
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Planner
Projects
None yet
2 participants