Microsoft365DSC
Microsoft365DSC copied to clipboard
EXOSharedMailbox: Invoke-DscResource -Test: Resource not found
Description of the issue
Until version 1.24.117.1 I did not get this error, since version 1.24.221.1 I get the following error:
code:
` $sharedMailboxConfig = @{ Name = 'EXOSharedMailbox' Property = @{ DisplayName = $displayName Alias = $json.mail.trim() PrimarySMTPAddress = "$($primarySMTPAddress.trim())" EmailAddresses = @("$($json.mail)@tttech365.mail.onmicrosoft.com", "$($json.mail)@tttech365.onmicrosoft.com") Ensure = ($json.requestType -like "delete")? ( "Absent" ) : ( "Present" ) ApplicationId = $env:APPREGID TenantId = $env:AzureTenant CertificatePath = $env:CERT_CONTENT CertificatePassword = (New-Object System.Management.Automation.PSCredential -ArgumentList "CertificatePassword", $password) } ModuleName = 'Microsoft365DSC' #Verbose = $true } Invoke-DscResource @sharedMailboxConfig -Method Set | Out-Null
`
I rolled back to Version 1.24.117.1 for now.
Curiously the problem only exists when creating new resources, as I applied a configuration to a existing mailbox, it worked
Microsoft 365 DSC Version
1.24.221.1 + 1.24.228.1
Which workloads are affected
Exchange Online
The DSC configuration
$sharedMailboxConfig = @{
Name = 'EXOSharedMailbox'
Property = @{
DisplayName = $displayName
Alias = $json.mail.trim()
PrimarySMTPAddress = "$($primarySMTPAddress.trim())"
EmailAddresses = @("$($json.mail)@tttech365.mail.onmicrosoft.com", "$($json.mail)@tttech365.onmicrosoft.com")
Ensure = ($json.requestType -like "*delete*")? ( "Absent" ) : ( "Present" )
ApplicationId = $env:APPREGID
TenantId = $env:AzureTenant
CertificatePath = $env:CERT_CONTENT
CertificatePassword = (New-Object System.Management.Automation.PSCredential -ArgumentList "CertificatePassword", $password)
}
ModuleName = 'Microsoft365DSC'
#Verbose = $true
}
Verbose logs showing the problem
No response
Environment Information + PowerShell Version
OsName : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Oils you share the outcome of get-DscResource for this resource?
Oils you share the outcome of get-DscResource for this resource?
What do you mean by "Oils you share"? @andikrueger
Could… obvious typo on my end.
As I rolled back the server (need a working version for prod), I can only provide the output from my own machine:
Get-DscResource EXOSharedMailbox
ImplementationDetail : ScriptBased
ResourceType : MSFT_EXOSharedMailbox
Name : EXOSharedMailbox
FriendlyName : EXOSharedMailbox
Module : Microsoft365DSC
ModuleName : Microsoft365DSC
Version : 1.24.228.1
Path : C:\Users\fasteiner\OneDrive - TTTECH COMPUTERTECHNIK
AG\Documents\PowerShell\Modules\Microsoft365DSC\1.24.228.1\DscResources\MSFT_EXOSharedMailbox\MSFT_EXOSharedMailbox.psm1
ParentPath : C:\Users\fasteiner\OneDrive - TTTECH COMPUTERTECHNIK AG\Documents\PowerShell\Modules\Microsoft365DSC\1.24.228.1\DscResources\MSFT_EXOSharedMailbox
ImplementedAs : PowerShell
CompanyName : Microsoft Corporation
Properties : {DisplayName, Alias, ApplicationId, CertificatePassword…}
We are not able to replicate on our end. Curious if you get the same results with PowerShell 5?
I just ran it interactively in Powershell 7 - works fine, when I launch it from Jenkins it does not find the resource - very curious.
Ahhh I found the issue:
works fine:
Invoke-DscResource @sharedMailboxConfig -Method Set
throws the mentioned error:
$state = Invoke-DscResource @sharedMailboxConfig -Method Test
can you replicate that? @NikCharlebois
Seems to happen with other resources as well:
seems this occurs when Invoke-DscResource is run multiple times
Temporary Workaround: run every single command in a child job, to have a new context everytime
@NikCharlebois any updates?