dsccommunity / ComputerManagementDsc

DSC resources for for configuration of a Windows computer. These DSC resources allow you to perform computer management tasks, such as renaming the computer, joining a domain and scheduling tasks as well as configuring items such as virtual memory, event logs, time zones and power settings.
https://dsccommunity.org
MIT License
309 stars 82 forks source link

Unable to Compile ComputerManagementDsc in Azure Automation Acct #418

Closed bantaba closed 1 year ago

bantaba commented 1 year ago

Problem description

I'm testing share creation with DSC using Azure Automation acct. used sample code from https://github.com/dsccommunity/ComputerManagementDsc/wiki/SmbShare.

I'm able to upload the configuration in Azure, but when I try to compile it fails with the error below. I've already imported the ComputerManagementDsc module

image image

Not sure why this is failing, other DSC configs I've uploaded are working without issue.

Verbose logs

Exception calling "NewScriptBlock" with "1" argument(s): "At line:5 char:5 + Import-DSCResource -ModuleName ComputerManagementDsc -Name SmbSh ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Unable to load resource 'SmbShare': Resource not found. At line:9 char:9 + SmbShare 'TempShare' + ~~~~~~~~ Undefined DSC resource 'SmbShare'. Use Import-DSCResource to import the resource." (At line:5 char:5 + Import-DSCResource -ModuleName ComputerManagementDsc -Name SmbSh ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Unable to load resource 'SmbShare': Resource not found. At line:9 char:9 + SmbShare 'TempShare' + ~~~~~~~~ Undefined DSC resource 'SmbShare'. Use Import-DSCResource to import the resource.)

DSC configuration

Configuration TestSmb
{
    Import-DscResource -ModuleName PSDesiredStateConfiguration
    Import-DSCResource -ModuleName ComputerManagementDsc -Name SmbShare

    Node localhost
    {
        SmbShare 'TempShare'
        {
            Name = 'Temp'
            Path = 'C:\Temp'
            Description = 'Some description'
            ConcurrentUserLimit = 20
            EncryptData = $false
            FolderEnumerationMode = 'AccessBased'
            CachingMode = 'Manual'
            ContinuouslyAvailable = $false
            FullAccess = @()
            ChangeAccess = @('AdminUser1')
            ReadAccess = @('Everyone')
            NoAccess = @('DeniedUser1')
        }
    }
}

Suggested solution

no

Operating system the target node is running

On Azure

PowerShell version and build the target node is running

Runtime version: 5.1

ComputerManagementDsc version

Module version: 5.0.0.0
Size: 349.117 KB
Type: Default
johlju commented 1 year ago

Not sure why this happens, maybe due to -Name SmbShare. But the problem should be in Azure side, and not an issue with the module. Closing this as it is external to this module, if this is still an issue, please reach out to the Slack/Discord #dsc channel for potential help.