Installing the tentacle on Azure virtual machines

Hi,

I tried to install Octopus extension in Microsoft Asure following this guide:
http://docs.octopusdeploy.com/display/OD/Azure+Virtual+Machines

The tentacle seems to be installed successfully, but the machine doesn’t appear in the specified environment. I checked the logs in the folder C:\WindowsAzure\Logs\Plugins\Microsoft.Powershell.DSC\1.3.0.0.

I’ve found the following:

[2015-06-28T08:18:17] Creating working directory:
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.3.0.0\DSCWork\Octopus.0
[2015-06-28T08:18:18] Downloading configuration package
[2015-06-28T08:18:18] Downloading
https://octodeploy.blob.core.windows.net/octopus-azure/Octopus.zip to C:\Packag
es\Plugins\Microsoft.Powershell.DSC\1.3.0.0\DSCWork\Octopus.0\Octopus.zip
[2015-06-28T08:18:20] Extracting Octopus.zip
[2015-06-28T08:18:21] Installing custom DSC resource modules to C:\Program
Files\WindowsPowerShell\Modules
[2015-06-28T08:18:21] Installing custom DSC resource module OctopusDSC
[2015-06-28T08:18:21] Applying DSC configuration under
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.3.0.0\DSCWork\Octopus.0
[2015-06-28T08:18:22] Writing handler status to
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.3.0.0\Status\0.status
[2015-06-28T08:18:22] Executing configuration script: C:\Packages\Plugins\Micro
soft.Powershell.DSC\1.3.0.0\DSCWork\Octopus.0\Octopus.ps1
[2015-06-28T08:18:24] Preparing configuration data
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.3.0.0\bin\DscExtensionHandler.ps
1 : Error enabling the DSC Extension: You cannot call a method on a
null-valued expression.
At line:1 char:1

  • .\bin\DscExtensionHandler.ps1 -Verbose *> C:\WindowsAzure\Logs\Plugin …
  •   + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep 
     tion
      + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio 
     n,DscExtensionHandler.ps1
    
    
    

What’s wrong?

Hi,

Thanks for getting in touch! Taking a look at the log you posted I can’t narrow down to the root cause of the issue. In the meantime can you check a few things for me?

  1. What Operating System are you using for your VM? The Tentacle Extension is only supported on Windows Server 2012 R2.
  2. Did you reboot the server after enabling the Tentacle Extension? The extension relies on a PowerShell DSC module, which in turn depends on some Windows updates.

Whilst I’m waiting for you to get back to me with those details I’m going to set up an Octopus Server and Tentacle on two different Azure VMs from scratch and see if there’s any issues with the process or the documentation.

Hope that helps!

Mike

Hi,

Systeminfo:

OS Name: Microsoft Windows Server 2012 R2 Datacenter
OS Version: 6.3.9600 N/A Build 9600
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Server
OS Build Type: Multiprocessor Free

Yes, I have rebooted the server. Today I faced with another error, which caused the tentacle was not installed at all:

[2015-06-29T15:04:43] Creating working directory:
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.3.0.0\DSCWork\Octopus.0
[2015-06-29T15:04:44] Downloading configuration package
[2015-06-29T15:04:44] Downloading
https://octodeploy.blob.core.windows.net/octopus-azure/Octopus.zip to C:\Packag
es\Plugins\Microsoft.Powershell.DSC\1.3.0.0\DSCWork\Octopus.0\Octopus.zip
[2015-06-29T15:05:17] An error occurred while downloading the configuration
package; removing
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.3.0.0\DSCWork\Octopus.0
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.3.0.0\bin\DscExtensionHandler.ps
1 : Error enabling the DSC Extension: An error occurred downloading the Azure
Blob: The remote server returned an error: (500) Internal Server Error.
The Set-AzureVMDscExtension cmdlet grants access to the blobs only for 1 hour;
have you exceeded that interval?
At line:1 char:1

  • .\bin\DscExtensionHandler.ps1 -Verbose *> C:\WindowsAzure\Logs\Plugin …
  •   + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep
     tion
      + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
     n,DscExtensionHandler.ps1
    
    
    

Here is my installation script:

$ErrorActionPreference = “Stop”

$vm = Get-AzureVM -Name “myhostname” -ServiceName "myservicename"
While ($vm.InstanceStatus -ne “ReadyRole”)
{
Start-Sleep -Seconds 5
}

$octopusConfiguration = ConvertTo-Json -Depth 8 @{
SasToken = ""
ModulesUrl = "https://octodeploy.blob.core.windows.net/octopus-azure/Octopus.zip"
ConfigurationFunction = "Octopus.ps1\OctopusAzureConfig"
Properties = @{
ApiKey = "API-XXXXXX"
OctopusServerUrl = "https://myoctopusserver"
Environments = "Production"
Roles = "MyRole"
ListenPort = 10933
}
}

$vm = Set-AzureVMExtension -VM $vm
-Publisher Microsoft.Powershell -ExtensionName DSC
-Version 1.3 -Verbose
-PublicConfiguration $octopusConfiguration `
$vm | Update-AzureVM

Restart-AzureVM -ServiceName “myservicename” -Name “myhostname”

Hi,

Thanks for getting back to us! As promised I also walked through the installation on Azure a couple of times and sadly it wasn’t the super duper happy outcome we both expected. I’m really sorry this has happened, we don’t have any automated testing for this particular scenario yet. I’m so glad you reached out, otherwise we wouldn’t have known the extension was broken.

At this point I can see that we haven’t changed anything that would impact the installation process, however our extension was built against the Azure DSC Extension v1.3 which has since been updated several times to v1.10.1 (and apparently v2.0 though that doesn’t seem to be live yet): http://blogs.msdn.com/b/powershell/archive/2014/11/20/release-history-for-the-azure-dsc-extension.aspx

And as part of that these updates have included two new releases of the Windows Management Framework 5.0 Preview (Nov 2015 and Apr 2015).

I’m going to keep investigating this further and will keep in touch with you about it.

In the meantime I’m going to try installing the extension using the PowerShell snippet mentioned in the documentation - this will allow me to specify which version of the PowerShell DSC Extension to use.

Thanks also for the other log trace, I’m going to look into that further as well. I had an issue with adding the extension, then removing it, and attempting to re-install it.

Hope that helps!

Mike

Hi,

I’ve run a fair few more tests today and have discovered several things on the journey.

  1. I’ve run quite a few tests where I’ve configured the VM using https://portal.azure.com and set up both the Endpoint (Port 10933) and the Octopus Extension as part of creating the VM. This worked for me every time (when Azure would actually create the VM without failing internally - see below).
  2. There seems to be an intermittent issue with the Public IP discovery step, and other people are experiencing the same thing. Take a look at the issues and pull-requests in https://github.com/OctopusDeploy/OctopusDSC. I’m going to investigate these and make some changes.
  3. I’ve had the Azure Portal fail to create VMs for me multiple times which looks like an Azure issue, but it’s certainly slowing down my ability to test.

What I’d recommend is to try configuring the VM + Endpoint + Octopus Extension in one hit like I did and see if it works for you. If not please send me the log you get from the Azure Portal - I’m very interested to see what’s going wrong.

In the meantime I’ll continue to look into what potential issues may be stopping this from working reliably. It’s certainly our intention that this process works first time, every time!

Hope that helps,

Mike

It’s not an option for us to create VM from the portal, because we have to deploy huge number of VMs. Manually it is too much work.

Anyway I tried what you recommended, and got error:

{“status”:“Failed”,“error”:{“code”:“ResourceDeploymentFailure”,“message”:“The resource operation completed with terminal provisioning state ‘Failed’.”,“details”:[{“code”:“VirtualMachineProvisioningFailed”,“message”:“The virtual machine ‘mymachine’ provisioning state is ‘Failed’, because extension ‘Microsoft.Powershell.DSC’ is in state ‘Ready’.”}]}}

Hi Istvan,

Thanks for getting back to us! That makes sense when you’re dealing with a lot of VMs, the Azure Extension was just built as more of a convenience feature when people are evaluating Octopus. From inspecting the few log traces you sent us it appears there’s some instability in the Azure DSC Extension itself. Given that, my recommendation to you is to avoid using the Azure DSC Extension, and consider other routes of achieving the same outcome.

A lot of Customers are taking the DSC resources as a baseline and invoking those directly using PowerShell remoting, especially to avoid vendor lock-in: https://github.com/OctopusDeploy/OctopusDSC

Depending on how many VMs you need to manage you may want to consider a form of PaaS, like Azure Cloud Services (Web/Worker Roles), and there’s brilliant community contribution called AzureWebFarm.OctopusDeploy which bootstraps your Web Role, installs a Tentacle, and installs the current Releases: https://github.com/MRCollective/AzureWebFarm.OctopusDeploy

We do have the outstanding issue of Public IP Address resolution (https://github.com/OctopusDeploy/OctopusDSC/issues/10) which we will close as soon as we can, but in the meantime you could use one of the other forks where some people have opted to use the public CNAME instead of IP Addresses.

Please let me know if there’s anything else we can help you with in the meantime.

Hope that helps!

Mike