Reputation: 43
I'm trying to install an Octopus tentacle as part of an Azure deploy using Powershell DCS extension
I've installed OctopusDSC under the automation user and it appears in the module list
ResourceGroupName : RESOURCEGROUP
AutomationAccountName : AUTOMATIONUSER
Name : OctopusDSC
IsGlobal : False
Version :
SizeInBytes : 0
ActivityCount : 0
CreationTime : 22/02/2017 14:03:07 +00:00
LastModifiedTime : 22/02/2017 14:04:42 +00:00
ProvisioningState : Succeeded
I've then created a powershell script with a basic install that is trying to import the module (first few lines below):
Configuration installoctopus
{
Import-DscResource -ModuleName OctopusDSC
But then I get the error during deployment:
Unable to load resource 'OctopusDSC': Resource not found.\r\n\r\nAt C:\Packages\Plugins\Microsoft.Powershell.DSC\2.22.0.0\DSCWork\installoctopus2.0\installoctopus2.ps1:8 char:7\r\n+ cTentacleAgent OctopusTentacle\r\n+
I've tired with Import-DscResource -Module OctopusDSC as well as Import-DscResource -Module * but get the same errors
One of the first parts of the OctopusDSC documentation is
First, ensure the OctopusDSC module is on your $env:PSModulePath. Then you can create and apply configuration like this.
but I didn't have to do this for the cChoco DSC (and I'm unsure how to do it as part of a DSC configuration?) module which works fine. Is this a different type of module that requires extra import options? Is it actually a powershell module and required to be on the guest VM despite being in the Azure automation module list
Upvotes: 0
Views: 312
Reputation: 8737
The OctopusDSC resource needs to be on the guest VM for the Import-DscResource -ModuleName OctopusDSC
cmd to succeed on the guest VM. So make sure it's in the ZIP file that contains your configuration script.
The easiest way to get all the resources needed into the zip file is to create it with the Publish-AzureRMVMDSCConfiguration
cmdlet and just use the OutputArchivePath param. But for that cmdlet to find it, it must be in $env:PSModulePath
on the machine where you run the cmdlet. So 1) install OctopusDSC in PSModulePath (on the "build" machine) and then 2) run the cmdlet.
Alternatively, you can manually add the OctopusDSC module to the zip file - usually this is just putting the folder in the zip file, but depending on the resource can mean more than that (I don't know of a good doc on manually creating it), but it's trivial to try this route and see if it works.
Upvotes: 0