# DSC does not locate/load module it needs as part of a configuration

**URL:** <https://forums.powershell.org/t/dsc-does-not-locate-load-module-it-needs-as-part-of-a-configuration/12768>\
**Category:** DSC\
**Created:** [June 24, 2019, 9:21am UTC](https://forums.powershell.org/t/dsc-does-not-locate-load-module-it-needs-as-part-of-a-configuration/12768 "2019-06-24T09:21:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cxmelga](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@cxmelga](https://forums.powershell.org/u/cxmelga)\
**Post date:** [June 24, 2019, 9:21am UTC](https://forums.powershell.org/t/dsc-does-not-locate-load-module-it-needs-as-part-of-a-configuration/12768/1 "2019-06-24T09:21:27Z")

</div>

Can someone please help me with the following issue

I am using DSC in Azure (Azure Automation DSC)

I receive the following error message,

PowerShell DSC resource MSFT\_ScriptResource failed to execute Get-TargetResource functionality  
with error message: The term ‘MyFunction’ is not recognized as the name of a cmdlet, function, script file, or  
operable program.

Here is the background

```
function MyFunction {

#code here ......

}
Export-ModuleMember -Function MyFunction
```

I saved the above as a .PSM1 and imported to Azure Automation (to the Modules section)  
I see the module in Azure Automation and when I click on it I can see the MyFunction ‘activity’ so all looks good

I then do the following in my DSC

```
Configuration MyConfig {

Import-DSCResource -ModuleName MyFunction

Script MyScript {
getScript = {code here}

test-Script = {
code .....
$X = MyFunction
code...
}

setScript = {coe here}

}
```

So basically I am calling MyFunction (which shows as an ‘activity’ when looking at the module in the modules section of azure automation). However it cannot be found hence the message at the top of this post

However I receive the error that the MyFunction is

Do you know what I am doing wrong here please? am I missing a step, do I need to do something else?

Thanks

CXMelga

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 9:16pm UTC](https://forums.powershell.org/t/dsc-does-not-locate-load-module-it-needs-as-part-of-a-configuration/12768/2 "2024-05-16T21:16:20Z")

</div>


