diff --git a/.github/workflows/PublishGitHubPages.yml b/.github/workflows/PublishGitHubPages.yml index 5db8507be7..fc0fdfc32a 100644 --- a/.github/workflows/PublishGitHubPages.yml +++ b/.github/workflows/PublishGitHubPages.yml @@ -2,7 +2,7 @@ name: Generate Resources & Deploy GitHub Pages on: push: branches: - - master + - Master - Dev jobs: GenerateResource: @@ -38,7 +38,7 @@ jobs: needs: GenerateResource runs-on: ubuntu-latest - permissions: + permissions: contents: write pages: write diff --git a/.github/workflows/PublishToGallery.yml b/.github/workflows/PublishToGallery.yml index 68314c6627..780f9798ed 100644 --- a/.github/workflows/PublishToGallery.yml +++ b/.github/workflows/PublishToGallery.yml @@ -3,7 +3,7 @@ name: Publish to PowerShell Gallery on: push: branches: - - master + - Master jobs: PublishToGallery: diff --git a/.github/workflows/website-deploy-prod.yml b/.github/workflows/website-deploy-prod.yml index 8a8fcc7e09..35ad8da3eb 100644 --- a/.github/workflows/website-deploy-prod.yml +++ b/.github/workflows/website-deploy-prod.yml @@ -3,7 +3,7 @@ on: [push] jobs: build: - if: github.repository == 'microsoft/Microsoft365DSC' && github.event.ref == 'refs/heads/master' + if: github.repository == 'microsoft/Microsoft365DSC' && github.event.ref == 'refs/heads/Master' runs-on: ubuntu-latest environment: name: PROD @@ -36,7 +36,7 @@ jobs: path: ${{ github.workspace }}/generator/build deploy_prod: - if: github.repository == 'microsoft/Microsoft365DSC' && github.event.ref == 'refs/heads/master' + if: github.repository == 'microsoft/Microsoft365DSC' && github.event.ref == 'refs/heads/Master' runs-on: ubuntu-latest environment: name: PROD diff --git a/CHANGELOG.md b/CHANGELOG.md index ca56e58071..8ab2caaedf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ * SCDLPComplianceRule * Fix #4259 and #3845 +# 1.24.612.1 + +* IntuneAppConfigurationDevicePolicy + * Add conversion from `payloadJson` to actual JSON. +* SPOTenantSettings + * Connect to Graph before Sharepoint Online. + FIXES [#4746](https://github.com/microsoft/Microsoft365DSC/issues/4746) +* TeamsMeetingPolicy + * Updated the allowed values for the TeamsCameraFarEndTPTXZmode property. +* M365DSCResourceGenerator + * Fix formatting and missing escape character in Resource Generator # 1.24.605.1 @@ -19,6 +30,8 @@ * M365DSCDRGUtil * Add multiple commands for Intune policies that use the settings catalog. * Improve comparison of Intune assignments in `Compare-M365DSCIntunePolicyAssignment` +* TeamsMeetingPolicy + * Updated the allowed values for the TeamsCameraFarEndTPTXZmode property. * DEPENDENCIES * Updated MSCloudLoginAssistant to version 1.1.17. * Updated ReverseDSC to version 2.0.0.20. @@ -54,13 +67,13 @@ * IntuneDeviceConfigurationPlatformScriptWindows * Initial Release - FIXES [#4157](https://github.com/microsoft/Microsoft365DSC/issues/4157) + FIXES [#4157](https://github.com/microsoft/Microsoft365DSC/issues/4157) * IntuneDeviceConfigurationPlatformScriptMacOS * Initial Release - FIXES [#4157](https://github.com/microsoft/Microsoft365DSC/issues/4157) + FIXES [#4157](https://github.com/microsoft/Microsoft365DSC/issues/4157) * IntuneDeviceEnrollmentPlatformRestriction * Fix missing export of the default policy - FIXES [#4694](https://github.com/microsoft/Microsoft365DSC/issues/4694) + FIXES [#4694](https://github.com/microsoft/Microsoft365DSC/issues/4694) * IntuneDeviceEnrollmentStatusPageWindows10 * Return all authentication methods when retrieving the policies otherwise it may fail deducing the OrganizationName via TenantId diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppConfigurationDevicePolicy/MSFT_IntuneAppConfigurationDevicePolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppConfigurationDevicePolicy/MSFT_IntuneAppConfigurationDevicePolicy.psm1 index 358626cb85..221e0db766 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppConfigurationDevicePolicy/MSFT_IntuneAppConfigurationDevicePolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneAppConfigurationDevicePolicy/MSFT_IntuneAppConfigurationDevicePolicy.psm1 @@ -200,11 +200,17 @@ function Get-TargetResource } } + $payloadJson = $null + if (-not [System.String]::IsNullOrEmpty($getValue.AdditionalProperties.payloadJson)) + { + $payloadJson = [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($getValue.AdditionalProperties.payloadJson)) + } + $results = @{ #region resource generator code ConnectedAppsEnabled = $getValue.AdditionalProperties.connectedAppsEnabled PackageId = $getValue.AdditionalProperties.packageId - PayloadJson = $getValue.AdditionalProperties.payloadJson + PayloadJson = $payloadJson PermissionActions = $complexPermissionActions ProfileApplicability = $enumProfileApplicability EncodedSettingXml = $getValue.AdditionalProperties.encodedSettingXml @@ -362,6 +368,11 @@ function Set-TargetResource $platform = 'ios' } + if (-not [System.String]::IsNullOrEmpty($BoundParameters.PayloadJson)) + { + $BoundParameters.PayloadJson = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($BoundParameters.PayloadJson)) + } + $mobileApps = Get-MgBetaDeviceAppManagementMobileApp -All $targetedApps = @() foreach ($targetedApp in $TargetedMobileApps) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantSettings/MSFT_SPOTenantSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantSettings/MSFT_SPOTenantSettings.psm1 index 6409765020..d14f915b7a 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantSettings/MSFT_SPOTenantSettings.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOTenantSettings/MSFT_SPOTenantSettings.psm1 @@ -149,8 +149,8 @@ function Get-TargetResource ) Write-Verbose -Message 'Getting configuration for SPO Tenant' - $ConnectionMode = New-M365DSCConnection -Workload 'PNP' -InboundParameters $PSBoundParameters $ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' -InboundParameters $PSBoundParameters + $ConnectionMode = New-M365DSCConnection -Workload 'PNP' -InboundParameters $PSBoundParameters #Ensure the proper dependencies are installed in the current environment. Confirm-M365DSCDependencies @@ -393,11 +393,11 @@ function Set-TargetResource Add-M365DSCTelemetryEvent -Data $data #endregion - $ConnectionMode = New-M365DSCConnection -Workload 'PNP' -InboundParameters $PSBoundParameters if (-not [string]::IsNullOrEmpty($TenantDefaultTimezone)) { $ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' -InboundParameters $PSBoundParameters } + $ConnectionMode = New-M365DSCConnection -Workload 'PNP' -InboundParameters $PSBoundParameters $CurrentParameters = $PSBoundParameters $CurrentParameters.Remove('Credential') | Out-Null @@ -672,10 +672,10 @@ function Export-TargetResource try { - $ConnectionMode = New-M365DSCConnection -Workload 'PNP' ` - -InboundParameters $PSBoundParameters $ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' ` -InboundParameters $PSBoundParameters + $ConnectionMode = New-M365DSCConnection -Workload 'PNP' ` + -InboundParameters $PSBoundParameters #Ensure the proper dependencies are installed in the current environment. Confirm-M365DSCDependencies diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.psm1 index dcbe4bea2b..935863f5c8 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.psm1 @@ -262,7 +262,7 @@ function Get-TargetResource $StreamingAttendeeMode = 'Enabled', [Parameter()] - [ValidateSet('Disabled', 'Enabled')] + [ValidateSet('Disabled', 'AutoAcceptInTenant', 'AutoAcceptAll')] [System.String] $TeamsCameraFarEndPTZMode, @@ -683,7 +683,7 @@ function Set-TargetResource $StreamingAttendeeMode = 'Enabled', [Parameter()] - [ValidateSet('Disabled', 'Enabled')] + [ValidateSet('Disabled', 'AutoAcceptInTenant', 'AutoAcceptAll')] [System.String] $TeamsCameraFarEndPTZMode, @@ -1065,7 +1065,7 @@ function Test-TargetResource $StreamingAttendeeMode = 'Enabled', [Parameter()] - [ValidateSet('Disabled', 'Enabled')] + [ValidateSet('Disabled', 'AutoAcceptInTenant', 'AutoAcceptAll')] [System.String] $TeamsCameraFarEndPTZMode, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.schema.mof index 21f5324574..cec9b406f9 100644 Binary files a/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.schema.mof and b/Modules/Microsoft365DSC/DSCResources/MSFT_TeamsMeetingPolicy/MSFT_TeamsMeetingPolicy.schema.mof differ diff --git a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 index cfe31609ea..4aeeec83ea 100644 --- a/Modules/Microsoft365DSC/Microsoft365DSC.psd1 +++ b/Modules/Microsoft365DSC/Microsoft365DSC.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 2024-06-05 +# Generated on: 2024-06-12 @{ @@ -11,7 +11,7 @@ # RootModule = '' # Version number of this module. - ModuleVersion = '1.24.605.1' + ModuleVersion = '1.24.612.1' # Supported PSEditions # CompatiblePSEditions = @() @@ -142,15 +142,15 @@ IconUri = 'https://github.com/microsoft/Microsoft365DSC/blob/Dev/Modules/Microsoft365DSC/Dependencies/Images/Logo.png?raw=true' # ReleaseNotes of this module - ReleaseNotes = '* AADEntitlementManagementRoleAssignment - * Initial Release. - * M365DSCResourceGenerator - * Add support for generating Intune settings catalog policies - * M365DSCDRGUtil - * Add multiple commands for Intune policies that use the settings catalog - * DEPENDENCIES - * Updated MSCloudLoginAssistant to version 1.1.17. - * Updated ReverseDSC to version 2.0.0.20.' + ReleaseNotes = '* IntuneAppConfigurationDevicePolicy + * Add conversion from `payloadJson` to actual JSON. +* SPOTenantSettings + * Connect to Graph before Sharepoint Online + FIXES [#4746](https://github.com/microsoft/Microsoft365DSC/issues/4746) +* TeamsMeetingPolicy + * Updated the allowed values for the TeamsCameraFarEndTPTXZmode property. +* M365DSCResourceGenerator + * Fix formatting and missing escape character in Resource Generator' # Flag to indicate whether the module requires explicit user acceptance for install/update # RequireLicenseAcceptance = $false diff --git a/ResourceGenerator/M365DSCResourceGenerator.psm1 b/ResourceGenerator/M365DSCResourceGenerator.psm1 index 3c5c585ac9..71a21e7ade 100644 --- a/ResourceGenerator/M365DSCResourceGenerator.psm1 +++ b/ResourceGenerator/M365DSCResourceGenerator.psm1 @@ -393,16 +393,16 @@ function New-M365DSCResource { $getAlternativeFilterString.AppendLine(" -Filter `"$alternativeKey eq '`$$alternativeKey'`" ``") | Out-Null $getAlternativeFilterString.AppendLine(" -ErrorAction SilentlyContinue | Where-Object ``") | Out-Null - $getAlternativeFilterString.AppendLine(" -FilterScript { ``") | Out-Null - $getAlternativeFilterString.AppendLine(" `$_.AdditionalProperties.'@odata.type' -eq `"`#microsoft.graph.$SelectedODataType`" ``") | Out-Null + $getAlternativeFilterString.AppendLine(" -FilterScript {") | Out-Null + $getAlternativeFilterString.AppendLine(" `$_.AdditionalProperties.'@odata.type' -eq `"`#microsoft.graph.$SelectedODataType`"") | Out-Null $getAlternativeFilterString.Append(" }") | Out-Null } else { $getAlternativeFilterString.AppendLine(" -ErrorAction SilentlyContinue | Where-Object ``") | Out-Null - $getAlternativeFilterString.AppendLine(" -FilterScript { ``") | Out-Null + $getAlternativeFilterString.AppendLine(" -FilterScript {") | Out-Null $getAlternativeFilterString.AppendLine(" `$_.$alternativeKey -eq `"`$(`$$alternativeKey)`" ``") | Out-Null - $getAlternativeFilterString.AppendLine(" -and `$_.AdditionalProperties.'@odata.type' -eq `"`#microsoft.graph.$SelectedODataType`" ``") | Out-Null + $getAlternativeFilterString.AppendLine(" -and `$_.AdditionalProperties.'@odata.type' -eq `"`#microsoft.graph.$SelectedODataType`"") | Out-Null $getAlternativeFilterString.Append(" }") | Out-Null } Write-TokenReplacement -Token '' -Value $getAlternativeFilterString.ToString() -FilePath $moduleFilePath @@ -477,16 +477,16 @@ function New-M365DSCResource $newDefaultParameterSet = $newCmdlet.ParameterSets | Where-Object -FilterScript { $_.Name -eq 'Create' } [Array]$newKeyIdentifier = ($newDefaultParameterSet.Parameters | Where-Object -FilterScript { $_.IsMandatory }).Name $defaultCreateParameters = @" - `$CreateParameters = ([Hashtable]`$BoundParameters).clone() - `$CreateParameters = Rename-M365DSCCimInstanceParameter -Properties `$CreateParameters - `$CreateParameters.Remove('Id') | Out-Null + `$createParameters = ([Hashtable]`$BoundParameters).clone() + `$createParameters = Rename-M365DSCCimInstanceParameter -Properties `$createParameters + `$createParameters.Remove('Id') | Out-Null - `$keys = (([Hashtable]`$CreateParameters).clone()).Keys + `$keys = (([Hashtable]`$createParameters).clone()).Keys foreach (`$key in `$keys) { - if (`$null -ne `$CreateParameters.`$key -and `$CreateParameters.`$key.getType().Name -like '*cimInstance*') + if (`$null -ne `$createParameters.`$key -and `$createParameters.`$key.GetType().Name -like '*CimInstance*') { - `$CreateParameters.`$key = Convert-M365DSCDRGComplexTypeToHashtable -ComplexObject `$CreateParameters.`$key + `$createParameters.`$key = Convert-M365DSCDRGComplexTypeToHashtable -ComplexObject `$createParameters.`$key } } "@ @@ -499,7 +499,7 @@ function New-M365DSCResource `$keys = (([Hashtable]`$UpdateParameters).clone()).Keys foreach (`$key in `$keys) { - if (`$null -ne `$UpdateParameters.`$key -and `$UpdateParameters.`$key.getType().Name -like '*cimInstance*') + if (`$null -ne `$UpdateParameters.`$key -and `$UpdateParameters.`$key.GetType().Name -like '*CimInstance*') { `$UpdateParameters.`$key = Convert-M365DSCDRGComplexTypeToHashtable -ComplexObject `$UpdateParameters.$key } @@ -520,16 +520,17 @@ function New-M365DSCResource $keyValue = $key if ($key -eq 'BodyParameter') { - $keyValue = 'CreateParameters' + $keyValue = 'createParameters' } $newParameterString.Append("-$key `$$keyValue") | Out-Null } [String]$newKeyIdentifier = $newParameterString.ToString() } + $odataType = $null if ($true)#$isAdditionalProperty) { - $odataType = " `$CreateParameters.Add(`"@odata.type`", `"#microsoft.graph.$SelectedODataType`")`r`n" + $odataType = " `$createParameters.Add(`"@odata.type`", `"#microsoft.graph.$SelectedODataType`")`r`n" } $settingsCatalogProperties = "" @@ -544,14 +545,14 @@ function New-M365DSCResource "@ $defaultCreateParameters = @" - `$settings = Get-IntuneSettingCatalogPolicySetting ` - -DSCParams ([System.Collections.Hashtable]`$BoundParameters) ` + `$settings = Get-IntuneSettingCatalogPolicySetting `` + -DSCParams ([System.Collections.Hashtable]`$BoundParameters) `` -TemplateId `$templateReferenceId - `$CreateParameters = @{ + `$createParameters = @{ Name = `$DisplayName Description = `$Description - TemplateReference = @{templateId = `$templateReferenceId } + TemplateReference = @{ templateId = `$templateReferenceId } Platforms = `$platforms Technologies = `$technologies Settings = `$settings @@ -586,15 +587,15 @@ function New-M365DSCResource if ($isAdditionalProperty -and $CmdletNoun -notlike "*DeviceManagementConfigurationPolicy") { $exportGetCommand.AppendLine(" -ErrorAction Stop | Where-Object ``") | Out-Null - $exportGetCommand.AppendLine(" -FilterScript { ``") | Out-Null - $exportGetCommand.AppendLine(" `$_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.$($selectedODataType)' ``") | Out-Null + $exportGetCommand.AppendLine(" -FilterScript {") | Out-Null + $exportGetCommand.AppendLine(" `$_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.$($selectedODataType)'") | Out-Null $exportGetCommand.AppendLine(" }") | Out-Null } elseif ($CmdletNoun -like "*DeviceManagementConfigurationPolicy") { $exportGetCommand.AppendLine(" -ErrorAction Stop | Where-Object ``") | Out-Null - $exportGetCommand.AppendLine(" -FilterScript { ``") | Out-Null - $exportGetCommand.AppendLine(" `$_.TemplateReference.TemplateId -eq `$policyTemplateID ``") | Out-Null + $exportGetCommand.AppendLine(" -FilterScript {") | Out-Null + $exportGetCommand.AppendLine(" `$_.TemplateReference.TemplateId -eq `$policyTemplateID") | Out-Null $exportGetCommand.AppendLine(" }") | Out-Null } else @@ -668,17 +669,17 @@ function New-M365DSCResource $updateKeyIdentifier = "" $updateCmdletName = "" $defaultUpdateParameters = @" - `$settings = Get-IntuneSettingCatalogPolicySetting ` - -DSCParams ([System.Collections.Hashtable]`$BoundParameters) ` + `$settings = Get-IntuneSettingCatalogPolicySetting `` + -DSCParams ([System.Collections.Hashtable]`$BoundParameters) `` -TemplateId `$templateReferenceId - Update-DeviceManagementConfigurationPolicy ` - -DeviceManagementConfigurationPolicyId `$currentInstance.Id ` - -DisplayName `$DisplayName ` - -Description `$Description ` - -TemplateReference `$templateReferenceId ` - -Platforms `$platforms ` - -Technologies `$technologies ` + Update-IntuneDeviceConfigurationPolicy `` + -DeviceConfigurationPolicyId `$currentInstance.Id `` + -Name `$DisplayName `` + -Description `$Description `` + -TemplateReferenceId `$templateReferenceId `` + -Platforms `$platforms `` + -Technologies `$technologies `` -Settings `$settings`r`n "@ } @@ -733,12 +734,13 @@ function New-M365DSCResource $AssignmentsNew += " `$assignmentsHash = @()`r`n" $AssignmentsNew += " foreach (`$assignment in `$Assignments)`r`n" $AssignmentsNew += " {`r`n" - $AssignmentsNew += " `$assignmentsHash += Get-M365DSCDRGComplexTypeToHashtable -ComplexObject `$Assignment`r`n" + $AssignmentsNew += " `$assignmentsHash += Get-M365DSCDRGComplexTypeToHashtable -ComplexObject `$assignment`r`n" $AssignmentsNew += " }`r`n" $AssignmentsNew += "`r`n" $AssignmentsNew += " if (`$policy.Id)`r`n" $AssignmentsNew += " {`r`n" - $AssignmentsNew += " Update-DeviceConfigurationPolicyAssignment -DeviceConfigurationPolicyId `$policy.Id ```r`n" + $AssignmentsNew += " Update-DeviceConfigurationPolicyAssignment ```r`n" + $AssignmentsNew += " -DeviceConfigurationPolicyId `$policy.Id ```r`n" $AssignmentsNew += " -Targets `$assignmentsHash ```r`n" $AssignmentsNew += " -Repository '$repository'`r`n" $AssignmentsNew += " }`r`n" @@ -746,12 +748,12 @@ function New-M365DSCResource $AssignmentsUpdate += " `$assignmentsHash = @()`r`n" $AssignmentsUpdate += " foreach (`$assignment in `$Assignments)`r`n" $AssignmentsUpdate += " {`r`n" - $AssignmentsUpdate += " `$assignmentsHash += Get-M365DSCDRGComplexTypeToHashtable -ComplexObject `$Assignment`r`n" + $AssignmentsUpdate += " `$assignmentsHash += Get-M365DSCDRGComplexTypeToHashtable -ComplexObject `$assignment`r`n" $AssignmentsUpdate += " }`r`n" $AssignmentsUpdate += " Update-DeviceConfigurationPolicyAssignment ```r`n" $AssignmentsUpdate += " -DeviceConfigurationPolicyId `$currentInstance.Id ```r`n" $AssignmentsUpdate += " -Targets `$assignmentsHash ```r`n" - $AssignmentsUpdate += " -Repository '$repository'`r`n" + $AssignmentsUpdate += " -Repository '$repository'" $AssignmentsCIM = @' [ClassVersion("1.0.0.0")] @@ -766,9 +768,9 @@ class MSFT_DeviceManagementConfigurationPolicyAssignments }; '@ - $AssignmentsProperty = " [Write, Description(`"Represents the assignment to the Intune policy.`"), EmbeddedInstance(`"MSFT_DeviceManagementConfigurationPolicyAssignments`")] String Assignments[];`r`n" + $AssignmentsProperty = "`r`n [Write, Description(`"Represents the assignment to the Intune policy.`"), EmbeddedInstance(`"MSFT_DeviceManagementConfigurationPolicyAssignments`")] String Assignments[];`r`n" $AssignmentsConvertComplexToString = @" - if (`$Results.Assignments) +`r`n if (`$Results.Assignments) { `$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString -ComplexObject `$Results.Assignments -CIMInstanceName DeviceManagementConfigurationPolicyAssignments if (`$complexTypeStringResult) @@ -779,14 +781,13 @@ class MSFT_DeviceManagementConfigurationPolicyAssignments { `$Results.Remove('Assignments') | Out-Null } - } + }`r`n "@ $AssignmentsConvertComplexToVariable = @" - if (`$Results.Assignments) +`r`n if (`$Results.Assignments) { - `$currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock `$currentDSCBlock -ParameterName "Assignments" -isCIMArray:`$true - } - + `$currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock `$currentDSCBlock -ParameterName "Assignments" -IsCIMArray:`$true + }`r`n "@ } Write-TokenReplacement -Token '' -Value $AssignmentsParam -FilePath $moduleFilePath @@ -811,27 +812,7 @@ class MSFT_DeviceManagementConfigurationPolicyAssignments `$ValuesToCheck.Add(`$_.Key, `$null) if (-not `$PSBoundParameters.ContainsKey(`$_.Key)) { - `$value = `$null - switch (`$CurrentValues[`$_.Key].GetType().Name) - { - 'Boolean' - { - `$value = `$false - } - 'String' - { - `$value = '' - } - 'Int32' - { - `$value = 0 - } - 'String[]' - { - `$value = @() - } - } - `$PSBoundParameters.Add(`$_.Key, `$value) + `$PSBoundParameters.Add(`$_.Key, `$null) } } } @@ -3310,7 +3291,7 @@ function New-M365HashTableMapping $convertToVariable += " if (`$Results.$parameterName)`r`n" $convertToVariable += " {`r`n" - $convertToVariable += " `$currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock `$currentDSCBlock -ParameterName `"$parameterName`" -isCIMArray:`$$($property.IsArray)`r`n" + $convertToVariable += " `$currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock `$currentDSCBlock -ParameterName `"$parameterName`" -IsCIMArray:`$$($property.IsArray)`r`n" $convertToVariable += " }`r`n" } if ($property.IsEnumType) @@ -3782,8 +3763,9 @@ function New-SettingsCatalogSettingDefinitionSettingsFromTemplate { $childSettings = @() $childSettings += $SettingTemplate.SettingDefinitions | Where-Object -FilterScript { - ($_.AdditionalProperties.dependentOn.Count -gt 0 -and $_.AdditionalProperties.dependentOn.parentSettingId.Contains($SettingDefinition.Id)) -or - ($_.AdditionalProperties.options.dependentOn.Count -gt 0 -and $_.AdditionalProperties.options.dependentOn.parentSettingId.Contains($SettingDefinition.Id)) + $_.visibility -notlike "*none*" -and + (($_.AdditionalProperties.dependentOn.Count -gt 0 -and $_.AdditionalProperties.dependentOn.parentSettingId.Contains($SettingDefinition.Id)) -or + ($_.AdditionalProperties.options.dependentOn.Count -gt 0 -and $_.AdditionalProperties.options.dependentOn.parentSettingId.Contains($SettingDefinition.Id))) } $setting = [ordered]@{ @@ -3830,7 +3812,7 @@ function New-ParameterDefinitionFromSettingsCatalogTemplateSetting { "SimpleIntegerCollection" = "System.Int32[]" } - $mofParameterTemplate = " [Write, Description("" "")] ;" + $mofParameterTemplate = " [Write, Description("""")] ;" $powerShellParameterTemplate = @" [Parameter()] [] @@ -3838,6 +3820,8 @@ function New-ParameterDefinitionFromSettingsCatalogTemplateSetting { "@ $mofDefinition = $mofParameterTemplate.Replace("", $TemplateSetting.DisplayName) + $optionsString = "" + $valueMapString = "" if ($TemplateSetting.Options) { $options = @() $values = @() @@ -3845,11 +3829,11 @@ function New-ParameterDefinitionFromSettingsCatalogTemplateSetting { $options += "$($_.Id)" + ": " + $_.Name.Replace("""", "'") $values += """$($_.Id)""" } - $optionsString = "(" + ($options -join ", ") + ")" - $ValueMapString = ", ValueMap{$($values -join ", ")}, Values{$($values -join ", ")}" + $optionsString = " (" + ($options -join ", ") + ")" + $valueMapString = ", ValueMap{$($values -join ", ")}, Values{$($values -join ", ")}" } $mofDefinition = $mofDefinition.Replace("", $optionsString) - $mofDefinition = $mofDefinition.Replace("", $ValueMapString) + $mofDefinition = $mofDefinition.Replace("", $valueMapString) $mofDefinition = $mofDefinition.Replace("", $mofTypeMapping[$TemplateSetting.Type]) $mofDefinition = $mofDefinition.Replace("", $TemplateSetting.Name) $isCollection = $TemplateSetting.Type -like "*Collection" diff --git a/ResourceGenerator/Module.Template.psm1 b/ResourceGenerator/Module.Template.psm1 index a03262750a..e54b40f83a 100644 --- a/ResourceGenerator/Module.Template.psm1 +++ b/ResourceGenerator/Module.Template.psm1 @@ -69,7 +69,7 @@ function Get-TargetResource { Write-Verbose -Message "Could not find an with {$}" - if (-not [string]::IsNullOrEmpty($)) + if (-not [System.String]::IsNullOrEmpty($)) { $getValue = ` @@ -78,11 +78,11 @@ function Get-TargetResource #endregionResourceGenerator#> if ($null -eq $getValue) { - Write-Verbose -Message "Could not find an with {$}" + Write-Verbose -Message "Could not find an with {$}." return $nullResult } $ = $getValue. - Write-Verbose -Message "An with {$} and {$} was found."<#ResourceGenerator + Write-Verbose -Message "An with {$} and {$} was found"<#ResourceGenerator ResourceGenerator#> $results = @{<#ResourceGenerator #region resource generator code @@ -176,12 +176,12 @@ function Set-TargetResource <#AssignmentsRemove#> <#DefaultUpdateParameters#><#ResourceGenerator #region resource generator code - <#UpdateKeyIdentifier#> -<#AssignmentsUpdate#> #endregionResourceGenerator#> +<#UpdateKeyIdentifier#><#AssignmentsUpdate#> + #endregionResourceGenerator#> } elseif ($Ensure -eq 'Absent' -and $currentInstance.Ensure -eq 'Present') { - Write-Verbose -Message "Removing the with {$($currentInstance.)}" <#ResourceGenerator + Write-Verbose -Message "Removing the with {$($currentInstance.)}"<#ResourceGenerator #region resource generator code <#removeKeyIdentifier#> #endregionResourceGenerator#> @@ -260,7 +260,7 @@ function Test-TargetResource { $source = $PSBoundParameters.$key $target = $CurrentValues.$key - if ($source.GetType().Name -like '*CimInstance*') + if ($null -ne $source -and $source.GetType().Name -like '*CimInstance*') { $source = Get-M365DSCDRGComplexTypeToHashtable -ComplexObject $source diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationDevicePolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationDevicePolicy.Tests.ps1 index 8d66e2ec3d..37b613ff24 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationDevicePolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationDevicePolicy.Tests.ps1 @@ -71,7 +71,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { displayName = "FakeStringValue" id = "FakeStringValue" PackageId = "FakeStringValue" - PayloadJson = "FakeStringValue" + PayloadJson = "{`"test`":`"value`"}" permissionActions = [CimInstance[]]@( (New-CimInstance -ClassName MSFT_MicrosoftGraphandroidPermissionAction -Property @{ permission = "FakeStringValue" @@ -119,7 +119,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { displayName = "FakeStringValue" id = "FakeStringValue" PackageId = "FakeStringValue" - PayloadJson = "FakeStringValue" + PayloadJson = "{`"test`":`"value`"}" permissionActions = [CimInstance[]]@( (New-CimInstance -ClassName MSFT_MicrosoftGraphandroidPermissionAction -Property @{ permission = "FakeStringValue" @@ -148,7 +148,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { AdditionalProperties = @{ appSupportsOemConfig = $True '@odata.type' = "#microsoft.graph.androidManagedStoreAppConfiguration" - payloadJson = "FakeStringValue" + payloadJson = "eyJ0ZXN0IjoidmFsdWUifQ==" profileApplicability = "default" permissionActions = @( @{ @@ -192,7 +192,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { displayName = "FakeStringValue" id = "FakeStringValue" PackageId = "FakeStringValue" - PayloadJson = "FakeStringValue" + PayloadJson = "{`"test`":`"value`"}" permissionActions = [CimInstance[]]@( (New-CimInstance -ClassName MSFT_MicrosoftGraphandroidPermissionAction -Property @{ permission = "FakeStringValue" @@ -221,7 +221,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { AdditionalProperties = @{ appSupportsOemConfig = $True '@odata.type' = "#microsoft.graph.androidManagedStoreAppConfiguration" - payloadJson = "FakeStringValue" + payloadJson = "eyJ0ZXN0IjoidmFsdWUifQ==" profileApplicability = "default" permissionActions = @( @{ @@ -258,7 +258,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { displayName = "FakeStringValue" id = "FakeStringValue" PackageId = "FakeStringValue" - PayloadJson = "FakeStringValue" + PayloadJson = "{`"test`":`"value`"}" permissionActions = [CimInstance[]]@( (New-CimInstance -ClassName MSFT_MicrosoftGraphandroidPermissionAction -Property @{ permission = "FakeStringValue" @@ -293,7 +293,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { action = "prompt" } ) - payloadJson = "FakeStringValue" + payloadJson = "eyJ0ZXN0IjoidmFsdWUifQ==" } createdDateTime = "2023-01-01T00:00:00.0000000+01:00" description = "FakeStringValue" @@ -334,7 +334,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { AdditionalProperties = @{ appSupportsOemConfig = $True '@odata.type' = "#microsoft.graph.androidManagedStoreAppConfiguration" - payloadJson = "FakeStringValue" + payloadJson = "{`"test`":`"value`"}" profileApplicability = "default" permissionActions = @( @{ diff --git a/docs/docs/resources/teams/TeamsMeetingPolicy.md b/docs/docs/resources/teams/TeamsMeetingPolicy.md index 0f044db4e6..eb0d697b33 100644 --- a/docs/docs/resources/teams/TeamsMeetingPolicy.md +++ b/docs/docs/resources/teams/TeamsMeetingPolicy.md @@ -42,7 +42,7 @@ | **RoomAttributeUserOverride** | Write | String | Determines whether or not biometric data will be used to distinguish and or attribute in the transcript. | `Off`, `Distinguish`, `Attribute` | | **StreamingAttendeeMode** | Write | String | Determines whether or not meetings created by users with this policy are able to utilize the meeting overflow capability. | `Disabled`, `Enabled` | | **AllowBreakoutRooms** | Write | Boolean | Determines whether or not meetings created by users with this policy are able to utilize the Breakout Rooms feature. | | -| **TeamsCameraFarEndPTZMode** | Write | String | Determines whether or not meetings created by users with this policy are able to utilize the Camera Far-End PTZ Mode. | `Disabled`, `Enabled` | +| **TeamsCameraFarEndPTZMode** | Write | String | Determines whether or not meetings created by users with this policy are able to utilize the Camera Far-End PTZ Mode. | `Disabled`, `AutoAcceptInTenant`, `AutoAcceptAll` | | **AllowMeetingReactions** | Write | Boolean | Determines whether or not meetings created by users with this policy are able to utilize the Meeting Reactions feature. | | | **WhoCanRegister** | Write | String | Specifies who can attend and register for webinars. | `Everyone`, `EveryoneInCompany` | | **AllowAnnotations** | Write | Boolean | N/A | |