diff --git a/CHANGELOG.md b/CHANGELOG.md index a2b3d7eb35..d7e0cedc42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,9 @@ * DEPENDENCIES * Updated MSCloudLoginAssistant to version 1.0.96; * MISC - * Add support for ManagedIdentity to the SPo and OD resources. + * Add support for ManagedIdentity to the SPO and OD resources. + * Fixed and issue with Export and ApplicationSecret where it wasn't properly converting to a PSCredential. + * FIXES [#2447](https://github.com/microsoft/Microsoft365DSC/issues/2447) # 1.22.1019.1 diff --git a/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 index feb54d2578..57a29564ee 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCReverse.psm1 @@ -234,10 +234,12 @@ function Start-M365DSCConfigurationExtract $AuthMethods -contains 'CertificatePath' -or ` $AuthMethods -contains 'ApplicationWithSecret') { + [SecureString]$secStringPassword = ConvertTo-SecureString $ApplicationSecret -AsPlainText -Force + [PSCredential]$AppSecretAsPSCredential = New-Object System.Management.Automation.PSCredential ('ApplicationSecret', $secStringPassword) $organization = Get-M365DSCTenantDomain -ApplicationId $ApplicationId ` -TenantId $TenantId ` -CertificateThumbprint $CertificateThumbprint ` - -ApplicationSecret $ApplicationSecret ` + -ApplicationSecret $AppSecretAsPSCredential ` -CertificatePath $CertificatePath } elseif ($AuthMethods -Contains 'Credentials') diff --git a/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 index 8300c41805..180d2d50bf 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 @@ -1376,7 +1376,7 @@ function Get-M365DSCTenantDomain $TenantId, [Parameter(ParameterSetName = 'AppId')] - [System.String] + [System.Management.Automation.PSCredential] $ApplicationSecret, [Parameter(ParameterSetName = 'AppId')]